发布版本:transformClassesAndResourcesWithProguardForRelease FAILED

Release build: transformClassesAndResourcesWithProguardForRelease FAILED

生成签名 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.

UPDStacktrace 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。如何(我阅读日志)我必须找出 类 丢失的内容?我应该在哪里看?要寻找什么?

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

问题 2:您应该修复此警告:

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: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource

您可以尝试将此添加到您的混淆器文件中:

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

你可以在这里看到缺少 类 的内容

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: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource

看看如何实现 proguard 来处理这个 类,你可以尝试将它添加到你的 proguard-rules.pro 文件:

-dontwarn android.arch.**

或者您可以从构建中禁用混淆器 ()