期望类型和名称而不仅仅是 'setExtensionCallback'

Expecting type and name instead of just 'setExtensionCallback'

我正在尝试为我的应用程序生成签名的 apk,但失败并出现错误 Expecting type and name instead of just 'setExtensionCallback' before '(' in line 326 of file 'pathtofile\release\consumer-rules.pro', 我不确定是什么原因造成的,也没有任何进一步的信息或任何关于它的详细报告。这是 consumer-rules.pro-

的第 325 和 326 行
-if class androidx.window.layout.SidecarCompat {
  public setExtensionCallback(androidx.window.layout.ExtensionInterfaceCompat$ExtensionCallbackInterface);
}

我正在为此使用 dexguard。几天前它还在工作,但突然停止了。

这里是 dexguard-project.txt 文件。

# Display some more statistics about the processed code.
-verbose


# Encrypt the assets.
-encryptassetfiles assets/**



#enable all rasp checks
-raspchecks *
-raspcontinueon *
-raspcallback class com.appname.name.SplashActivity{
    public static void mRaspCallback(com.guardsquare.dexguard.rasp.callback.DetectionReport);
}


#project related
-keep class com.appname.name.constants
-keep class com.shockwave.**
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-dontwarn org.xmlpull.v1.**
-dontwarn android-support-v4.**
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep public class com.google.** {*;}
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
# Huawei Map Config
-ignorewarnings
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable

-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}

-keep class org.xms.g.maps.ExtensionMapOptions{*;}
-keep class com.huawei.hms.maps.HuaweiMapOptions{*;}
-keep interface org.xms.g.maps.OnMapReadyCallback{*;}
-keep interface com.huawei.hms.maps.OnMapReadyCallback{*;}
-keep class org.xms.g.maps.StreetViewPanoramaOptions{*;}
-keep class com.huawei.hms.maps.OnStreetViewPanoramaReadyCallback{*;}
-keep interface org.xms.g.maps.OnStreetViewPanoramaReadyCallback{*;}
-keep interface com.huawei.hms.maps.OnStreetViewPanoramaReadyCallback{*;}
-keep class com.huawei.hms.dynamicloader.** { *; }
-keep class com.huawei.hms.feature.dynamic.** {*;}
-keep class com.huawei.hms.feature.** { *;}
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8


# For OkHttp 3.x
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }

# crashlytics
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

-keep class com.pushwoosh.** { *; }
-dontwarn com.pushwoosh.**

-keep class pushwooshnotification.PushwooshNotificationService {*;}


-keep class kotlin.** { *; }

您能否尝试保留所有 class 元数据

-keep class androidx.window.layout.SidecarCompat {
 *;
 }
-keepkotlinmetadata

此问题现已在 dex-guard.9.3.3

的最新版本中修复