-
Notifications
You must be signed in to change notification settings - Fork 375
Description
Summary
com.onesignal:OneSignal:5.7.3 fails release minification with R8 because io.opentelemetry:opentelemetry-sdk-logs:1.55.0 references com.google.auto.value.AutoValue$CopyAnnotations, but the dependency chain does not provide the annotation class and the shipped consumer Proguard rules do not suppress it.
I originally hit this while integrating react-native-onesignal 5.4.0 via onesignal-expo-plugin 2.4.0, but I reduced it to a plain Android repro without Expo or React Native.
Minimal Repro
Environment:
- macOS
- JDK 17
- Gradle 9.0.0
- Android Gradle Plugin 8.12.0
- compileSdk 36
- minSdk 26
app/build.gradle:
plugins {
id("com.android.application")
}
android {
namespace "com.example.onesignalr8repro"
compileSdk 36
defaultConfig {
applicationId "com.example.onesignalr8repro"
minSdk 26
targetSdk 36
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
shrinkResources false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.onesignal:OneSignal:5.7.3")
}app/proguard-rules.pro:
# intentionally empty
Run:
./gradlew clean app:minifyReleaseWithR8Actual Result
R8 fails with:
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in app/build/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class com.google.auto.value.AutoValue$CopyAnnotations (referenced from: io.opentelemetry.sdk.logs.ExtendedSdkLogRecordData and 1 other context)
Android Gradle also generates:
# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.auto.value.AutoValue$CopyAnnotations
Dependency Chain
./gradlew app:dependencies --configuration releaseRuntimeClasspath shows:
\--- com.onesignal:OneSignal:5.7.3
+--- com.onesignal:otel:5.7.3
| \--- io.opentelemetry:opentelemetry-sdk-logs:1.55.0
Additional Observation
The consumer Proguard rules shipped in com.onesignal:otel:5.7.3 only contain:
# OpenTelemetry OTLP exporter references Jackson core classes that are optional on Android.
# Suppress R8 missing-class errors when apps don't include jackson-core.
-dontwarn com.fasterxml.jackson.core.**
There is no suppression for com.google.auto.value.*.
Workaround
Adding this to the app's Proguard rules unblocks the build:
-dontwarn com.google.auto.value.**
Question
Would you consider adding the appropriate consumer Proguard rule in the SDK (or otherwise adjusting the dependency setup) so release builds do not fail under R8 by default?