Questions tagged [android-r8]

Questions related to R8, the default shrinker tool used in the Android build process

R8 is a tool designed to replace ProGuard as the default shrinker in the Android build process

303 questions
8
votes
1 answer

Android dynamic features with DataBinding and R8

I have problem with usage of DataBinding in my Dynamic Feature module. I can't generate binding object related for my fragment when isMinifyEnabled = true Generally I try to do it using this code: val viewDataBinding: FragmentFeature1Binding =…
8
votes
1 answer

How to make R8 + proguard-android-optimize.txt + Google Drive API works seamlessly?

This is our R8 version Current version is: 1.4.94 (build 390954928f0db9c3b888a367f7f128ce3bbfb160 from go/r8bot (luci-r8-ci-archive-0-5g74)). When I switch from buildTypes { release { minifyEnabled true proguardFiles…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
7
votes
1 answer

R8 Compatibility With Sealed Class In Android Studio Flamingo

When I want to release my app get this error: com.android.tools.r8.internal.jb: Sealed classes are not supported as program classes when generating class files Android Studio: Flamingo 2022.2.1 (also i try 2022.3.1 Giraffe) Gradle Version: 8.0…
Ghasem
  • 467
  • 5
  • 8
7
votes
0 answers

Code shrinker R8 crashes my Xamarin.Android app on startup with Unable to get provider com.google.firebase.provider.FirebaseInitProvider

I have a Xamarin.Android app which I recently switched to use R8 code shrinker. Unfortunately, my app is crashing on startup with the following error: java.lang.RuntimeException: Unable to get provider…
7
votes
0 answers

How to keep class names and method names with Android R8 for remote aar file?

I'm writing Android Studio library by crerating an aar file. I installed this file on maven repository in private network. I'm trying now to enable users to know only about the classes names and method names, with the help of this question in…
Roie Shlosberg
  • 189
  • 1
  • 7
7
votes
0 answers

Android R8 - Missing classes

I'm using Android-R8 and the following R8-warnings are present: R8 warnings Missing class: javax.xml.stream.XMLStreamReader Missing class: javax.xml.stream.util.XMLEventAllocator Missing class: javax.xml.stream.events.Characters Missing…
AceStan
  • 109
  • 1
  • 1
  • 7
7
votes
1 answer

R8 stripping out Kotlin companion object needed for reflection

I have a class with a companion object which implements a factory interface. class GoalInspectorData( ... ) { companion object : DataClassFactory { override fun fromV8Object(v8Object: V8Object): GoalInspectorData…
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
7
votes
2 answers

Duplicate class found in modules with R8 enabled

I created two aar-libraries: com.example:test1:1.0.0 and com.example:test2:1.0.0. I added these libs to my main app and after build Android-Studio throws error: Duplicate class com.example.utils.a found in modules classes.jar…
7
votes
2 answers

Could not set unknown property 'enableR8' for object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension

i add this code in android studio 3.2; android.enableR8 = true Could not set unknown property 'enableR8' for object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension What does it mean ?
Alireza
  • 446
  • 4
  • 15
6
votes
1 answer

Android R8 Error after updating dependencies

I have updated all of my project dependencies and I'm getting different Errors of R8. AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{}],"tool":"D8"} org.gradle.workers.WorkerExecutionException: There was a failure while…
Nisar Ahmad
  • 1,987
  • 3
  • 13
  • 30
6
votes
3 answers

Enabling R8 in android kotlin app cause Library class android.content.res.XmlResourceParser implements program class org.xmlpull.v1.XmlPullParser

I enabled R8 plugging for obfuscation I got an exception when I am trying to generate the signed apk "Library class android.content.res.XmlResourceParser implements program class org.xmlpull.v1.XmlPullParser" I have added below proGuard rule to the…
6
votes
0 answers

Missing class com.google.errorprone.annotations.Immutable on building release apk with R8

I am getting below error on building the release apk with R8 enabled: Task :app:minifyReleaseWithR8 AGPBI: {"kind":"warning","text":"Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are…
Nitin Verma
  • 485
  • 4
  • 19
6
votes
1 answer

keep assets folder in proguard Android

I'm using proguard to obfuscate my code, and I have one module called a library and in that module I have an assets folder and I'm keeping some jars that I'm using in runtime. I want to keep that assets folder in the proguard. Here is how it's…
Harsh Shah
  • 2,162
  • 2
  • 19
  • 39
6
votes
2 answers

Proguard (R8) negate operator not working to keep anything except certain packages

The negator (exclamation mark) in proguard should allow me to keep anthing but the apache libraries: -keep class !org.apache.** According to those answers. That's the way to go: How to negate classname with Proguard Enable Proguard for only two…
OneWorld
  • 17,512
  • 21
  • 86
  • 136
6
votes
2 answers

Android lifecycle observers don't trigger when code is minified by R8

When i build my code with minifyEnabled=true then lifecycle observers don't trigger on any events. lifecycle.addObserver(object : LifecycleObserver { @OnLifecycleEvent(Lifecycle.Event.ON_ANY) @Keep fun anyEvent(source: LifecycleOwner,…
darken
  • 807
  • 12
  • 25
1 2
3
20 21