我知道在另一个线程上有一个答案,但是我觉得这无关。
(也许是,但是我希望得到一个更详尽的答案)
所以我将这些保存在我的proguard.rules中:
-dontwarn com.google.android.instantapps.supervisor.InstantAppsRuntime
-keep class com.google.android.instantapps.supervisor.InstantAppsRuntime
-dontwarn com.google.android.gms.ads.AdView
-keep class com.google.android.gms.ads.AdView
-dontwarn com.google.android.gms.tagmanager.TagManagerService
-keep class com.google.android.gms.tagmanager.TagManagerService
-dontwarn io.grpc.netty.NettyChannelProvider
-keep class io.grpc.netty.NettyChannelProvider
-dontwarn io.opencensus.impl.tags.TagsComponentImpl
-keep class io.opencensus.impl.tags.TagsComponentImpl
-dontwarn io.opencensus.impllite.tags.TagsComponentImplLite
-keep class io.opencensus.impllite.tags.TagsComponentImplLite
-dontwarn io.opencensus.impl.stats.StatsComponentImpl
-keep class io.opencensus.impl.stats.StatsComponentImpl
-dontwarn io.opencensus.impllite.stats.StatsComponentImplLite
-keep class io.opencensus.impllite.stats.StatsComponentImplLite
但是在编译应用程序时,我仍然收到所有这些警告:
W/ProGuard: The class 'io.opencensus.stats.Stats' is calling Class.forName to retrieve
the class 'io.opencensus.impllite.stats.StatsComponentImplLite', but the latter could not be found.
It may have been obfuscated or shrunk.
You should consider preserving the class with its original name,
with a setting like:
-keep class io.opencensus.impllite.stats.StatsComponentImplLite
(这是一个示例)
为什么会这样? ProGuard是实际上保留了类,还是没有通过proguard.rules处理?
答案 0 :(得分:0)
这可能是因为您缺少项目中的opencensus库依赖项。
将以下行添加到gradle依赖项中,例如
dependencies {
implementation 'io.opencensus:opencensus-api:0.18.0'
}