gradle 缺少类com.google.devtools.build.android.desugar.runtime.ThrowableExtension

0s7z1bwu  于 10个月前  发布在  Go
关注(0)|答案(2)|浏览(210)

最近我把我的gradle版本从7.2升级到了8.1。升级后,我面临着

Missing class com.google.devtools.build.android.desugar.runtime.ThrowableExtension 
(referenced from: java.lang.String 
io.agora.base.internal.Logging.getStackTraceString(java.lang.Throwable) and 18 other 
contexts)

Missing class reactor.blockhound.integration.BlockHoundIntegration (referenced from: 
reactor.core.scheduler.ReactorBlockHoundIntegration)

字符串
当我尝试签署我的版本时会发生这种情况。我使用的是pro-guard规则,这可能是导致问题的原因。
目前为止我所尝试的

  • 升级到最新版本的Agora(4.2.6)
  • 更新Gradle版本至com.android.tools.build:gradle:8.2.0 '
  • 更新了reactor版本到 'org.jetbrains.kotlinx:kotlinx-coroutines- reactor:1.7.1'*
    Proguard规则:
-keepclassmembers,allowobfuscation class * {
    @com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation interface com.google.gson.annotations.SerializedName
# for glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

# for eventbus
-keepattributes *Annotation*
-keepclassmembers class * {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

# And if you use AsyncExecutor:
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}


-useuniqueclassmembernames

# These options produce useful stacktraces preserving line numbers
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

# Pdf viewer
-keep class com.shockwave.**
-keep class com.media365ltd.doctime.networking.retrofit_latest.**

#agora
-keep class io.agora.**{*;}

# Amazon Chime
-keep class com.amazonaws.** { *; }# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

                                   # A resource is loaded with a relative path so the package of this class must be preserved.
                                   -adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz

                                   # Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
                                   -dontwarn org.codehaus.mojo.animal_sniffer.*

                                   # OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
                                   -dontwarn okhttp3.internal.platform.**
                                   -dontwarn org.conscrypt.**
                                   -dontwarn org.bouncycastle.**
                                   -dontwarn org.openjsse.**

# Adjust
-keep class com.adjust.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
    int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    java.lang.String getId();
    boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }


任何见解都是高度赞赏。提前感谢。

tvz2xvvm

tvz2xvvm1#

更新ProGuard规则:

-keep class com.google.devtools.build.android.desugar.runtime.ThrowableExtension { *; }

字符串

oxalkeyp

oxalkeyp2#

我从Agora RTC v3.0.0.2升级到v4.2.6(最新版本)后遇到了类似的错误。该错误特别发生在生成签名的APK期间。幸运的是,我找到了解决这个问题的方法。
与一些建议相反,我发现没有必要在Proguard规则中添加以下行(前提是您使用的是Flamingo 2022.2.1 Patch 1或更高版本):

-dontwarn com.google.devtools.build.android.desugar.runtime.ThrowableExtension

字符串
相反,对我来说,解决问题的方法是包括这一行:

-dontwarn io.agora.**


对于上下文,我的Gradle插件版本(AGP)是8.1.2,Gradle版本是8.3。
此调整有助于成功缓解我在升级Agora RTC版本后在签名的APK构建过程中遇到的问题。
希望这能帮助其他遇到类似问题的人!

相关问题