我知道在另一个线程上有一个答案,但我觉得它无关。
(也许是,但我希望能有一个更详细的答案(
所以我的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进行处理?
这可能是因为您的项目中缺少opencensus库依赖项。
将下一行添加到您的等级依赖项中,例如
dependencies {
implementation 'io.opencensus:opencensus-api:0.18.0'
}