R8 release build fails with missing com.google.auto.value.AutoValue$CopyAnnotations in OneSignal 5.7.3
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:minifyReleaseWithR8
Actual 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?
Thanks for the clear repro and dependency breakdown.
What went wrong: com.onesignal:otel:5.7.3 on Maven shipped with consumer ProGuard rules that only had -dontwarn com.fasterxml.jackson.core.**. The Auto Value annotation types (AutoValue, AutoValue$Builder, AutoValue$CopyAnnotations) referenced from OpenTelemetry were not in that published consumer-rules.pro, so R8 correctly reported missing classes.
Status in the repo: The missing -dontwarn entries for those Auto Value types are now in 5.7.7 (and main) in OneSignalSDK/onesignal/otel/consumer-rules.pro, so if you can upgrade to the latest, you will see the fix for it. The fix was added here https://github.com/OneSignal/OneSignal-Android-SDK/pull/2589/changes#diff-8c9f49362c1a2dd1291c53967471af21f371ed6d26340ef4f660ff5c21236955
Opps within 5.7.6 I've getting too many ANRs cause one signal I don't why it is not realistic in case to prevent ANRs Kindly provide or to stable version as ANR cause downgrading to App.
main (runnable)
tid=1 systid=16479
Triggered ANR
Root blocking
0
libart.so
art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool) + 140
java.lang.Class.getMethods (Class.java:1493)
com.onesignal.common.modeling.Model.initializeFromJson (Model.kt:99)
com.onesignal.common.modeling.SimpleModelStore.create (SimpleModelStore.kt:30)
com.onesignal.common.modeling.ModelStore.load (ModelStore.kt:175)
com.onesignal.common.modeling.SimpleModelStore.<init> (SimpleModelStore.kt:23)
com.onesignal.core.internal.config.ConfigModelStore.<init> (ConfigModelStore.kt:9)
java.lang.reflect.Constructor.newInstance0 (Native method)