fix: 移除库模块 isMinifyEnabled 修复 Duplicate class 冲突
Android 库模块开启 isMinifyEnabled=true 时,R8 各自独立混淆, 将内部类重命名为 a.a / a.b 等短名打进 AAR;多个 AAR 合并到 App 时产生 Duplicate class 冲突。 修复:删除全部 7 个库模块 buildTypes.release 中的 isMinifyEnabled, 混淆由 App 的 R8 统一完成。将 proguard-rules.pro 中的保留规则 (manifest 注册类、反射调用入口、dontwarn)合并进各模块的 consumer-rules.pro 随 AAR 打包。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
7169e66ee9
当前提交
6d18af496b
@ -13,15 +13,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing { singleVariant("release") { withSourcesJar() } }
|
publishing { singleVariant("release") { withSourcesJar() } }
|
||||||
|
|
||||||
|
|||||||
@ -6,3 +6,14 @@
|
|||||||
-keep public class com.xuqm.sdk.bugcollect.LogLevel { public *; }
|
-keep public class com.xuqm.sdk.bugcollect.LogLevel { public *; }
|
||||||
-keep public class com.xuqm.sdk.bugcollect.Breadcrumb { public *; }
|
-keep public class com.xuqm.sdk.bugcollect.Breadcrumb { public *; }
|
||||||
-keep public class com.xuqm.sdk.bugcollect.FunnelTracker { public *; }
|
-keep public class com.xuqm.sdk.bugcollect.FunnelTracker { public *; }
|
||||||
|
-keep public class com.xuqm.sdk.bugcollect.IssueEvent { *; }
|
||||||
|
-keep public class com.xuqm.sdk.bugcollect.LogEvent { *; }
|
||||||
|
|
||||||
|
# ContentProvider: class name referenced in AndroidManifest — must not be renamed
|
||||||
|
-keep class com.xuqm.sdk.bugcollect.internal.BugCollectInitProvider
|
||||||
|
|
||||||
|
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
||||||
|
|
||||||
|
-keepclassmembers class com.xuqm.sdk.bugcollect.** {
|
||||||
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
|
}
|
||||||
|
|||||||
24
sdk-bugcollect/proguard-rules.pro
vendored
24
sdk-bugcollect/proguard-rules.pro
vendored
@ -1,23 +1 @@
|
|||||||
# BugCollect object: accessed via reflection from sdk-webview (captureError, INSTANCE)
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep class com.xuqm.sdk.bugcollect.BugCollect {
|
|
||||||
public *;
|
|
||||||
static <fields>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Public types passed to / returned from BugCollect public API
|
|
||||||
-keep public class com.xuqm.sdk.bugcollect.Breadcrumb { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.bugcollect.LogLevel { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.bugcollect.IssueEvent { *; }
|
|
||||||
-keep public class com.xuqm.sdk.bugcollect.LogEvent { *; }
|
|
||||||
-keep public class com.xuqm.sdk.bugcollect.FunnelTracker { public *; }
|
|
||||||
|
|
||||||
# ContentProvider: class name referenced in AndroidManifest — must not be renamed
|
|
||||||
-keep class com.xuqm.sdk.bugcollect.internal.BugCollectInitProvider
|
|
||||||
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# Gson field names in log payloads
|
|
||||||
-keepclassmembers class com.xuqm.sdk.bugcollect.** {
|
|
||||||
@com.google.gson.annotations.SerializedName <fields>;
|
|
||||||
}
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|||||||
@ -19,15 +19,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -20,7 +20,12 @@
|
|||||||
@com.google.gson.annotations.SerializedName <fields>;
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ── Kotlinx serialization ─────────────────────────────────────────────────────
|
||||||
|
-keepclassmembers @kotlinx.serialization.Serializable class ** { *; }
|
||||||
|
-keep class kotlinx.serialization.** { *; }
|
||||||
|
|
||||||
# ── Retrofit / OkHttp (belt-and-suspenders; they ship their own rules) ────────
|
# ── Retrofit / OkHttp (belt-and-suspenders; they ship their own rules) ────────
|
||||||
-keepattributes Signature
|
-keepattributes Signature
|
||||||
-keepattributes *Annotation*
|
-keepattributes *Annotation*
|
||||||
-keepattributes Exceptions
|
-keepattributes Exceptions
|
||||||
|
-keepattributes InnerClasses, EnclosingMethod
|
||||||
|
|||||||
18
sdk-core/proguard-rules.pro
vendored
18
sdk-core/proguard-rules.pro
vendored
@ -1,17 +1 @@
|
|||||||
# sdk-core is the base dependency for all other SDK modules.
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
# Renaming its classes would break the cross-module class references at runtime
|
|
||||||
# (each module's R8 sees sdk-core's minified output as classpath).
|
|
||||||
# Strategy: dead-code elimination only, no renaming.
|
|
||||||
-keep class com.xuqm.sdk.** { *; }
|
|
||||||
|
|
||||||
# Kotlin & annotation metadata (required by kotlinx.serialization and Compose)
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# Kotlinx serialization
|
|
||||||
-keepclassmembers @kotlinx.serialization.Serializable class ** { *; }
|
|
||||||
-keep class kotlinx.serialization.** { *; }
|
|
||||||
|
|
||||||
# Gson field names in network models
|
|
||||||
-keepclassmembers class com.xuqm.sdk.** {
|
|
||||||
@com.google.gson.annotations.SerializedName <fields>;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -17,15 +17,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
13
sdk-im/proguard-rules.pro
vendored
13
sdk-im/proguard-rules.pro
vendored
@ -1,12 +1 @@
|
|||||||
# Public API
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep public class com.xuqm.sdk.im.ImSDK { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.im.model.** { public *; }
|
|
||||||
-keep public interface com.xuqm.sdk.im.listener.** { public *; }
|
|
||||||
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# IM message payloads use Gson
|
|
||||||
-keepclassmembers class com.xuqm.sdk.im.** {
|
|
||||||
@com.google.gson.annotations.SerializedName <fields>;
|
|
||||||
}
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|||||||
@ -18,15 +18,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -12,6 +12,14 @@
|
|||||||
@com.google.gson.annotations.SerializedName <fields>;
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ContentProvider: class name referenced in AndroidManifest — must not be renamed
|
||||||
|
-keep class com.xuqm.sdk.license.internal.LicenseInitializerProvider
|
||||||
|
|
||||||
|
# ── Kotlinx serialization ─────────────────────────────────────────────────────
|
||||||
|
-keepclassmembers @kotlinx.serialization.Serializable class ** { *; }
|
||||||
|
-keep class kotlinx.serialization.** { *; }
|
||||||
|
|
||||||
# ── Retrofit / OkHttp ────────────────────────────────────────────────────────
|
# ── Retrofit / OkHttp ────────────────────────────────────────────────────────
|
||||||
-keepattributes Signature
|
-keepattributes Signature
|
||||||
-keepattributes *Annotation*
|
-keepattributes *Annotation*
|
||||||
|
-keepattributes InnerClasses, EnclosingMethod
|
||||||
|
|||||||
17
sdk-license/proguard-rules.pro
vendored
17
sdk-license/proguard-rules.pro
vendored
@ -1,16 +1 @@
|
|||||||
# Public API
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep public class com.xuqm.sdk.license.LicenseSDK { public *; }
|
|
||||||
-keep public interface com.xuqm.sdk.license.LicenseCallback { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.license.LicenseConfig { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.license.LicenseResult { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.license.model.** { public *; }
|
|
||||||
|
|
||||||
# ContentProvider: class name referenced in AndroidManifest — must not be renamed
|
|
||||||
-keep class com.xuqm.sdk.license.internal.LicenseInitializerProvider
|
|
||||||
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# Kotlinx serialization (used by this module)
|
|
||||||
-keepclassmembers @kotlinx.serialization.Serializable class ** { *; }
|
|
||||||
-keep class kotlinx.serialization.** { *; }
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|||||||
@ -20,15 +20,6 @@ android {
|
|||||||
manifestPlaceholders["XUQM_HONOR_APP_ID"] = ""
|
manifestPlaceholders["XUQM_HONOR_APP_ID"] = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -26,3 +26,14 @@
|
|||||||
-keepattributes Signature
|
-keepattributes Signature
|
||||||
-keepattributes *Annotation*
|
-keepattributes *Annotation*
|
||||||
-keepattributes Exceptions
|
-keepattributes Exceptions
|
||||||
|
-keepattributes InnerClasses, EnclosingMethod
|
||||||
|
|
||||||
|
# ── Optional deps (compileOnly) — suppress R8 missing-class warnings ──────────
|
||||||
|
-dontwarn com.google.android.gms.**
|
||||||
|
-dontwarn com.google.firebase.**
|
||||||
|
-dontwarn com.huawei.**
|
||||||
|
-dontwarn com.hihonor.**
|
||||||
|
-dontwarn io.github.hebeiliang.**
|
||||||
|
-dontwarn com.umeng.**
|
||||||
|
-dontwarn com.heytap.**
|
||||||
|
-dontwarn com.vivo.**
|
||||||
|
|||||||
27
sdk-push/proguard-rules.pro
vendored
27
sdk-push/proguard-rules.pro
vendored
@ -1,26 +1 @@
|
|||||||
# Public API entry point
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep public class com.xuqm.sdk.push.PushSDK { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.push.model.** { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.push.PushNotificationChannelManager { public *; }
|
|
||||||
|
|
||||||
# Service / Receiver classes registered in AndroidManifest — must NOT be renamed
|
|
||||||
-keep class com.xuqm.sdk.push.fcm.XuqmFirebaseMessagingService
|
|
||||||
-keep class com.xuqm.sdk.push.honor.XuqmHonorPushService
|
|
||||||
-keep class com.xuqm.sdk.push.huawei.XuqmHuaweiPushService
|
|
||||||
-keep class com.xuqm.sdk.push.xiaomi.XuqmXiaomiPushReceiver
|
|
||||||
-keep class com.xuqm.sdk.push.vivo.XuqmVivoPushReceiver
|
|
||||||
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|
||||||
# Firebase / GMS: compileOnly — transitive classes may be missing from classpath
|
|
||||||
-dontwarn com.google.android.gms.**
|
|
||||||
-dontwarn com.google.firebase.**
|
|
||||||
|
|
||||||
# Vendor push SDKs: compileOnly / optional transitive deps
|
|
||||||
-dontwarn com.huawei.**
|
|
||||||
-dontwarn com.hihonor.**
|
|
||||||
-dontwarn io.github.hebeiliang.**
|
|
||||||
-dontwarn com.umeng.**
|
|
||||||
-dontwarn com.heytap.**
|
|
||||||
-dontwarn com.vivo.**
|
|
||||||
|
|||||||
@ -17,15 +17,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
13
sdk-update/proguard-rules.pro
vendored
13
sdk-update/proguard-rules.pro
vendored
@ -1,12 +1 @@
|
|||||||
# Public API
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep public class com.xuqm.sdk.update.UpdateSDK { public *; }
|
|
||||||
-keep public interface com.xuqm.sdk.update.UpdateListener { public *; }
|
|
||||||
-keep public class com.xuqm.sdk.update.model.** { public *; }
|
|
||||||
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# Gson model fields in update info payload
|
|
||||||
-keepclassmembers class com.xuqm.sdk.update.** {
|
|
||||||
@com.google.gson.annotations.SerializedName <fields>;
|
|
||||||
}
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|||||||
@ -18,15 +18,6 @@ android {
|
|||||||
consumerProguardFiles("consumer-rules.pro")
|
consumerProguardFiles("consumer-rules.pro")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = true
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -1 +1,7 @@
|
|||||||
# Keep module rules intentionally empty for now.
|
# All webview classes are public API consumed directly by app code
|
||||||
|
-keep public class com.xuqm.sdk.webview.** { public *; }
|
||||||
|
|
||||||
|
# XWebViewActivity is registered in AndroidManifest — must not be renamed
|
||||||
|
-keep class com.xuqm.sdk.webview.XWebViewActivity
|
||||||
|
|
||||||
|
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
||||||
|
|||||||
13
sdk-webview/proguard-rules.pro
vendored
13
sdk-webview/proguard-rules.pro
vendored
@ -1,12 +1 @@
|
|||||||
# All webview classes are public API consumed directly by app code
|
# Library modules do not use isMinifyEnabled. Rules are in consumer-rules.pro.
|
||||||
-keep public class com.xuqm.sdk.webview.** { public *; }
|
|
||||||
|
|
||||||
# XWebViewActivity is registered in AndroidManifest — must not be renamed
|
|
||||||
-keep class com.xuqm.sdk.webview.XWebViewActivity
|
|
||||||
|
|
||||||
# Compose @Composable functions require annotation and signature retention
|
|
||||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
|
||||||
|
|
||||||
# sdk-core internal classes (auth/network) appear "missing" after sdk-core's R8 pass
|
|
||||||
# when both modules build in the same Gradle invocation; suppress to allow compilation
|
|
||||||
-dontwarn com.xuqm.sdk.**
|
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户