我们有以下设置(不确定哪个很重要):
>具有3个库模块(数据,域,utils)的应用程序项目(app)
>启用数据绑定(databinding.enabled为true)
>启用Proguard(proguardFiles’proguard-rules.pro’)
当我使用以下方式构建应用程序时:
./gradlew assembleDevRelease
我收到以下错误:
找不到引用的类my.package.data.R $raw
当我使用以下方式构建应用程序时:
./gradlew:app:assembleDevRelease
该应用程序构建良好,生成了一个模糊的* .apk,我可以安装它
题:
> assembleRelease和:app:assembleRelease有什么区别
-为什么切换到android gradle插件3.3.0会影响构建apk必须调用的任务?我们在CI管道的任何地方都使用assembleRelease来构建apk.
> android gradle插件3.3.0中发生了什么更改,导致任务assembleRelease中断?我们在CI管道的任何地方都使用assembleRelease来构建apk.
>关于如何使’assembleRelease’重新工作的任何建议? (更新Proguard配置?,启用R8?)
What’s the difference between
assembleRelease
and:app:assembleRelease
前者在相对于当前级别的所有模块上运行assembleRelease任务.后者仅在应用程序模块(及其依赖项)上运行它.
Why does switching to android gradle plugin 3.3.0 affect which task I have to call to build my apk? We use
assembleRelease
everywhere in our CI pipelines to build our apks.
该问题没有足够的信息可以肯定地说,但是release notes中列出了许多更改.例如,此问题可能与以下方面有关:
Faster R class generation for library projects: PrevIoUsly,the Android Gradle plugin would generate an
R.java
file for each of your project’s dependencies and then compile those R classes alongside your app’s other classes. The plugin now generates a JAR containing your app’s compiled R class directly,without first building intermediateR.java
classes. This optimization may significantly improve build performance for projects that include many library subprojects and dependencies,and improve the indexing speed in Android Studio.