Android studio - App with library project fails to build

后端 未结 2 1862
一生所求
一生所求 2020-12-05 04:43

I\'m having massive trouble trying to get my app project to build. I have the main app module and a library project module as shown below:

相关标签:
2条回答
  • 2020-12-05 04:58

    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).

    0 讨论(0)
  • 2020-12-05 05:05

    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.

    0 讨论(0)
提交回复
热议问题