{"id":26474021,"url":"https://github.com/dailystudio/devbricksx-android","last_synced_at":"2025-07-21T09:33:00.674Z","repository":{"id":43603634,"uuid":"264874323","full_name":"dailystudio/devbricksx-android","owner":"dailystudio","description":"DevBricksX provides plenty of useful classes that will be used in daily Android development.","archived":false,"fork":false,"pushed_at":"2025-07-05T17:06:45.000Z","size":55769,"stargazers_count":66,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-05T17:07:16.669Z","etag":null,"topics":["android","gradle-plugin","kotlin-android","ksp","paging3","photo-picker","recyclerview","room-persistence-library","utilities"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dailystudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-18T08:19:42.000Z","updated_at":"2025-07-05T17:06:50.000Z","dependencies_parsed_at":"2025-03-17T17:45:06.202Z","dependency_job_id":null,"html_url":"https://github.com/dailystudio/devbricksx-android","commit_stats":null,"previous_names":[],"tags_count":162,"template":false,"template_full_name":null,"purl":"pkg:github/dailystudio/devbricksx-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailystudio%2Fdevbricksx-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailystudio%2Fdevbricksx-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailystudio%2Fdevbricksx-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailystudio%2Fdevbricksx-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dailystudio","download_url":"https://codeload.github.com/dailystudio/devbricksx-android/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailystudio%2Fdevbricksx-android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265524907,"owners_count":23782057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","gradle-plugin","kotlin-android","ksp","paging3","photo-picker","recyclerview","room-persistence-library","utilities"],"created_at":"2025-03-19T22:39:51.677Z","updated_at":"2025-07-21T09:33:00.668Z","avatar_url":"https://github.com/dailystudio.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DevBricks X - Android\n[![License](https://poser.pugx.org/dreamfactory/dreamfactory/license.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/cn.dailystudio/devbricksx/badge.svg)](https://maven-badges.herokuapp.com/maven-central/cn.dailystudio/devbricksx)\n\n**DevBricksX** is a remake and extended version of [DevBricks](https://github.com/dailystudio/devbricks). It provides plenty of useful classes that will be used in daily Android development. With these \"bricks\", your development will become:\n\n- **Efficient**: The classes provided by DevBricks almost cover all of the aspects of daily development, from the low-end database to the user interface. You do not need to waste your time on repeated work.\n- **Reliable**:  It has been integrated into enormous products. Your work will stand on a stable foundation. \n- **Consistent**: It includes a unified logging system, database accessing, UI elements, and styles. This makes all of your applications have consistency in the primary impression.\n\nWith only a few lines, you can save in memory **User** objects into the database and represent them in a list:\n\n![](docs/assets/samples.png)\n\n\n## Quick Setup\nTo use **DevBricks X** Libraries in your application, follow the steps below. There are two options for you.\n\n### Option 1: One-step installation (Recommended)\nStarting from version **1.7.3**, you can simply use **DevBricks X** Libraries in your application by using the related Gradle plugin. Only apply plugin in **build.gradle** of your module:\n\n```Groovy\nplugins {\n    id(\"cn.dailystudio.devbricksx.devkit\") version \"$devkit_version\"\n}\n```\n\nThe latest version of the Gradle plugin is:\n\n```Groovy\ndevkit_version = \"2.0.4-1.2.1\"\n```\n\nThat's it. Everything is done. You can use anything provided by **DevBricks X**. \n\n\u003e The primary version (number ahead of minus) of the plugin indicates the corresponding DevBricksX libraries that the plugin uses. For example, plugin \"1.7.5-1.0.2\" uses DevBricksX 1.7.5, whereas plugin \"1.7.3-1.0.1\" uses DevBricksX 1.7.3.\n\nCompared to the manual installation below, the plugin helps you do the following things:\n\n- add libraries dependencies of DevBricksX. If the module is a library, dependencies are imported by using the keyword \"api\". If the module is an app, dependencies are imported by using the keyword \"implementation\".\n- apply the KSP plugin. (Only if you use annotation features)\n- add KSP processors dependencies of DevBricksX. (Only if you use annotation features)\n- add KSP processors dependencies of Room. (Only if you use annotation features)\n- specify Room schemas directory. (Only if you use annotation features)\n- add generated source directories of KSP to source sets. (Only if you use annotation features)\n\nCheck them carefully to avoid duplicated configurations in your build scripts. \n\nAnd, make sure you use the compatible Kotlin version. If you meet any problem with during the compilation, please refer to [Compatible Kotlin Gradle Plug-in](#2-compatible-kotlin-gradle-plug-in) for more information.\n\n\n### Option 2: Manual installation (Legacy)\nInstead, you can set up DevBricksX manually, especially for using those versions before **1.7.3**. \n\nAdd the following dependencies in build.gradle of your application.\n\n#### Dependencies\n\nFirst, you need to add dependencies in **build.gradle**:\n\n```groovy\n// (Optional) If you use annotations and processors to generate facilities, apply this plug-in\nplugins {\n  id(\"com.google.devtools.ksp\") version \"$ksp_version\"\n}\n\nrepositories { \n    mavenCentral()\n}\n\ndependencies {\n    // Basic Library for Android development\n    implementation \"cn.dailystudio:devbricksx:$devbricksx_version\"\n\n    // (Optional) Annotations and processors to generate facilities \n    implementation \"cn.dailystudio:devbricksx-annotations:$devbricksx_version\"\n    ksp \"cn.dailystudio:devbricksx-compiler:$devbricksx_version\"\n    // (Optional) If you use the feature above, DO NOT forget this line \n    ksp \"androidx.room:room-compiler:2.7.2\"\n}\n```\n\nThe latest version of the dependencies above are:\n\n```groovy\nksp_version = \"2.1.20-2.0.1\"\ndevbricksx_version = \"2.0.4\"\n```\n\nThen, if you are using annotations through [KSP (Kotlin Symbol Processing)](https://kotlinlang.org/docs/ksp-overview.html), DO NOT forget to add plug-ins repo in **settings.gradle**:\n\n```groovy\npluginManagement {\n    repositories {\n        gradlePluginPortal()\n    }\n}\n\n```\n\n#### Compile options\nAdd the following compile options in build.gradle of your application module. They are important, please DO NOT ignore them.\n\n```groovy\ncompileOptions {\n    sourceCompatibility JavaVersion.VERSION_21\n    targetCompatibility JavaVersion.VERSION_21\n}\n\nkotlinOptions {\n    jvmTarget = \"21\"\n}\n\n// If you are using KSP and your Room databases leveraging versioning features.\nksp {\n    arg(\"room.schemaLocation\", \"$projectDir/schemas\".toString())\n}\n\n// Source files generated by KSP cannot be recognized by default, \n// you should manually configure them into the source sets.\nsourceSets.configureEach {\n    kotlin.srcDir(\"$buildDir/generated/ksp/$name/kotlin/\")\n}\n\n```\n\n## Usage\n\nPowered by **DevBricksX** and corresponding **KSP** processors, you can get a **Fragment** with a list of **User** in less than 5 minutes.\n\n```kotlin\npackage com.dailystudio.devbricksx.samples.quickstart\n\n@RoomCompanion\n@ViewModel\n@Adapter(viewHolder = UserViewHolder::class)\n@ListFragment\ndata class User(\n\tval uid: Int,\n\tval firstName: String?,\n\tval lastName: String?\n)\n\nclass UserViewHolder(itemView: View): AbsSingleLineViewHolder\u003cUser\u003e(itemView) {\n\n    override fun getIcon(item: User): Drawable? {\n        return ResourcesCompatUtils.getDrawable(itemView.context,\n                R.mipmap.ic_user)\n    }\n\n    override fun getText(item: User): CharSequence? {\n        return buildString {\n            append(item.firstName)\n            append(' ')\n            append(item.lastName?.uppercase())\n        }\n    }\n\n}\n\n```\n\n### Simple usage\nSimply, you can directly embed a list Fragment of Users in your application, like this:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003candroidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".quickstart.CaseActivity\"\u003e\n\n    \u003cfragment\n        android:name=\"com.dailystudio.devbricksx.samples.quickstart.fragment.UsersListFragment\"\n        android:id=\"@+id/fragment_users\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintLeft_toLeftOf=\"parent\"\n        app:layout_constraintRight_toRightOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"/\u003e\n\n\u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\n```\nThen, you get the result like the screenshot shown above. \n\n### Generate data\nIn this case, the **User** data is stored persistently in the SQLite database. You manipulate these data by using auto-generated companion classes in different levels of [Recommendations for Android architecture](https://developer.android.com/topic/architecture/recommendations):\n\nUsing ViewModel,\n\n```kotlin\nval viewModel = ViewModelProvider(this)[UserViewModel::class.java]\n\nfor (i in 0 until NAMES_COUNT) {\n    val fIndex = RANDOM.nextInt(FIRST_NAMES.size)\n    val lIndex = RANDOM.nextInt(LAST_NAMES.size)\n\n    val user = User(0, FIRST_NAMES[fIndex], LAST_NAMES[lIndex])\n\n    viewModel.insertUser(user)\n}\n```\n\nUsing Room interfaces,\n\n```kotlin\nval database = UserDatabase.getDatabase(this)\n\nfor (i in 0 until NAMES_COUNT) {\n    val fIndex = RANDOM.nextInt(FIRST_NAMES.size)\n    val lIndex = RANDOM.nextInt(LAST_NAMES.size)\n\n    val user = User(0, FIRST_NAMES[fIndex], LAST_NAMES[lIndex])\n\n    database.userDao().insert(user)\n}\n```\n\n### Read data\nBy default, the auto-generated **ViewModel** class of **User** provides the following shortcut properties for you to access data:\n\n``` kotlin\npublic val allUsers: List\u003cUser\u003e\npublic val allUsersLive: LiveData\u003cList\u003cUser\u003e\u003e\npublic val allUsersLivePaged: LiveData\u003cPagedList\u003cUser\u003e\u003e\npublic val allUsersFlow: Flow\u003cList\u003cUser\u003e\u003e\npublic val allUsersPagingSource: PagingSource\u003cInt, User\u003e\n```\n\nIt almost covers all of the most popular ways of reading data. But, it also provides flexibility to extend interfaces of the ViewModel. For more details, please refer to the specific document.\n\n\n### Application initialization (Optional)\nThis step helps you to integrate parts of utilities automatically, such as Logging facilities. \n\nExtends your application from **DevBricksApplication**:\n\n```kotlin\nclass MyApplication : DevBricksApplication() {\n\n    override fun isDebugBuild(): Boolean {\n        return BuildConfig.DEBUG\n    }\n    \n}\n```\nThe **BuildConfig** is the one generated for your top-level application not those for modules. It provides information about your build type to the library.\n\nThen declare it in your **`AndroidMenifest.xml`**:\n\n``` xml\n\u003cmanifest\u003e\n    ...\n    \u003capplication\n        android:name=\".MyApplication\"\u003e\n        ...\n    \u003c/application\u003e\n    ...\n\u003c/manifest\u003e\n```\n\n### Others\n\nBesides, **DevBricksX** also provided sufficient facilities to accelerate your everyday development. For different topics, please read the instructions carefully in each topic for details.\n\n- [**Logging**](./docs/logging.md)\n\n    An enhanced logging system that can turn on/off debug outputs automatically.\n\n- [**Gloabl Context**](./docs/globalcontext.md)\n\n    A global context that you can use anywhere in your code without memory leaks.\n\n- [**Database**](./docs/database.md)\n    \n    A set of utilities to simplify the usage of Android Room components. It can generate Room, Dao, Database, and Repository for a class through one annotation.\n\n- [**UI**](./docs/ui.md)\n    \n    Plenty of classes to simplify high-level development. Combine with [**Database**](./docs/database.md) facilities, you can save an object in the database and then represent it in a list view with less than 20 lines of code.\n\n\n## Changelogs\n\n### 2.0.0\n- Compatible with Gradle 8.9, AGP (Android Gradle Plugin) 8.7.1, Kotlin 2.0.21\n- Support K2 Compiler\n- Fix collecting issue of AbsPrefs.preChanges caused incorrect destroy of Channels\n\n### 1.8.0\n\n- Compatible with Gradle 8.0, AGP (Android Gradle Plugin) 8.0.0, Kotlin 1.8.22\n- Fix issues after upgrade to AGP 8.0, including BuildConfig generation, R classes cascade\n- Adapt to Room 2.5.2 and Navigation 2.6.0\n- Fix the space wrap issue with KotlinPoet by using the symbol \"·\".\n- Fix different classes imports issue when using KotlinPoet.\n- Completely remove dependencies of Kapt modules.\n\n## Known issues\n\nIf you have encountered issues when you set up or use **DevBricksX**, you can first check the known issues below.\n\n### 1. Using KSP \n\nNow, **DevBricksX** is using **KSP (Kotlin Symbol Processing)** instead of **Kapt (the Kotlin Annotation Processing Tool)** to improve compilation performance and code quality. After version **1.6.6**, the following components are deprecated:\n \n- devbricksx-java-annotation\n- devbricksx-kotlin-annotation\n- devbricksx-java-compiler\n- devbricksx-kotlin-compiler\n\n### 2. Compatible Kotlin Gradle Plug-in\nStarting from version **1.7.3**, DevBricks X Libraries can use its Gradle plugin to help you set up projects. It applies the **KSP (Kotlin Symbol Processing)** plugin automatically. But if this KSP plugin version is not compatible with the **Kolitn Gradle Plugin** that you are using in your project. It might lead to a compiling issue.\n\n\u003eksp-1.8.22-1.0.11 is too new for kotlin-1.8.20. Please upgrade kotlin-gradle-plugin to 1.8.22.\n\nSo, if you get an issue and see a similar build output above, please change your Kotlin Gradle Plugin version, better to be the same as the one used by DevBricksX.\n\n### 3. @JvmField deprecation\nAfter version **1.5.9**, if you add compile options in your build script to use **Java 1.8** binary code, you have to remove all the **@JvmField** in your codes. \n\nThanks to the new features of Kotlin, there is no need to use this annotation anymore. It simplifies the usage of our annotation processor. You can refer to the issue [KT-46329](https://youtrack.jetbrains.com/issue/KT-46329?_gl=1*vz64qk*_ga*MjA4MzI5NTM0My4xNjc5NTYwNzcz*_ga_9J976DJZ68*MTY3OTkwNjQ4NC42LjAuMTY3OTkwNjQ4NC42MC4wLjA.\u0026_ga=2.56121960.2116670156.1679844726-2083295343.1679560773) for more details.\n\n### 4. Jcenter deprecation\nSince [JFrog to Shut down JCenter and Bintray](https://www.infoq.com/news/2021/02/jfrog-jcenter-bintray-closure/), starting from version **1.4.1**, all the artifacts will be maintained under the groupdId **cn.dailystudio**. The versions before that will still be available under the groupId **com.dailystudio**.\n\nFor example, if you want to refer to version **1.3.0**, you should add the following lines in your build.gradle\n\n```groovy\nrepositories { \n    mavenCentral()\n}\n\ndependencies {\n    implementation 'com.dailystudio:devbricksx:1.3.1'\n\n    implementation 'com.dailystudio:devbricksx-java-annotations:1.3.1'\n    implementation 'com.dailystudio:devbricksx-kotlin-annotations:1.3.1'\n\n    kapt 'com.dailystudio:devbricksx-java-compiler:1.3.1'\n    kapt 'com.dailystudio:devbricksx-kotlin-compiler:1.3.1'\n}\n```\n\n## License\n    Copyright 2023 Daily Studio.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n       http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailystudio%2Fdevbricksx-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdailystudio%2Fdevbricksx-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailystudio%2Fdevbricksx-android/lists"}