发布版本:transformClassesAndResourcesWithProguardForRelease FAILED

时间:2017-08-03 18:10:12

标签: android gradle proguard android-proguard

生成已签名的APK:

Note: there were 8 unresolved dynamic references to classes or interfaces.
Note: there were 4 accesses to class members by means of introspection.
Warning: there were 5 unresolved references to classes or interfaces.
Warning: there were 1 unresolved references to program class members.

transformClassesAndResourcesWithProguardForRelease FAILED

Full Gradle log is here

My app build.gradle is here

UPD 即可。 Stacktrace is here

如果我使用-ignorewarnings选项,则应用程序会在某些Android版本上崩溃。

大概在去了Room之后,我停止了生成签名的APK。 此外,我不得不将com.google.firebase,com.google.android.gms:play-services从11.0.4降级到11.0.2降级

两个简单的问题(对于那些知道的人)。

日志说:

Try: Run with --stacktrace option to get the stack trace. 
Run with --info or --debug option to get more log output.

Q1。我可以在Android Studio中指定“--stacktrace”,“ - info或--debug”选项吗?

Q2。如何(我阅读日志)我必须找出缺少哪些类?我应该在哪里看?该寻找什么?

2 个答案:

答案 0 :(得分:1)

Q1:在项目根目录的命令行中:./gradlew build --stacktrace

Q2:你应该修正这个警告:

Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find superclass or interface android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource$1: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource

您可以尝试将此添加到您的proguard文件中:

-dontwarn android.arch.util.paging.CountedDataSource
-dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource

答案 1 :(得分:0)

你可以在这里看到什么课程缺失

Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find superclass or interface android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning: android.arch.persistence.room.paging.LimitOffsetDataSource$1: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource

看看如何实施 proguard 来处理这些类,您可以尝试将其添加到 proguard-rules.pro 文件中:

-dontwarn android.arch.**

或者您可以从您的版本(here

中禁用proguard