Android studio - App with library project fails to build

风格不统一 提交于 2019-11-27 19:20:34
Scott Barta

When Gradle builds the library project, it's building the release type even if you're building the debug type for your main app (this is a bug). In your library project, you have Proguard configured for your release build type, and Proguard is obfuscating the symbol names, making them invisible to your app.

Since you control the library code, the best thing is to not run Proguard in your library build, and just run it for release builds of your main app. It will obfuscate all code, including the dependencies.

If you really want to obfuscate the library code independently, you'll need to set up the Proguard rules to expose the public symbols of the library, DatePickerDialog being one.

Just explicitly tells gradle that your library project must not being minified by adding/modifying section

android/buildTypes/debug

of your library project's build.gradle file like this (minifyEnabled false is the key):

android {
...
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
        }
...
    }
...
}

Note:

Here, I also instruct explicitly gradle to make my 'debug' build debuggable (debuggable true).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!