You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
R8 throws an error when code shrinker is set to none #4416
Why R8 is fired when mulidex is enabled? If that is default behavior, then visual studio csproj editor should check "codeshrinker" to d8 automatically when selecting multidex, otherwise developer don't know whats happening.
Reacted by Kacper Tryniecki, Anil Reddy and Emil Alipiev
Same issue facing R8 error in any mode (debug or release) even if code shrinker is set to none.
tried fixing this R8 issues with -dontwarn tag in proguard.cfg , cleaning sloution and deleting obj and bin folders and when ran application with debug mode throws error on app start up at MainActivity at base.OnCreate(bundle);
Same solution Working well on 16.4 after updating to 16.5 facing this issue.
** Please provide workaround as i am stuck, i cannot run my applications.
Why R8 is fired when mulidex is enabled? If that is default behavior, then visual studio csproj editor should check "codeshrinker" to d8 automatically when selecting multidex, otherwise developer don't know whats happening.
We have to run r8 for multi-dex support. This will not be using the code shrinking functionality unless you have AndroidLinkTool=r8.
Unfortunately r8 complains with an error like this if it can't find all java types used by the app:
2>R8 : warning : Missing class: com.google.android.gms.location.LocationListener
2>R8 : error : Compilation can't be completed because some library classes are missing.
I suspect that a missing NuGet package could solve the problem. I'll try the sample, I am not hitting an error with an empty project.
@jonathanpeppers Thanks! As i said, error is only with com.onesignal nuget package installed. You don't need to try sample as i opened new issue for the OneSignal team. All my concerns for the Xamarin.Android were about R8 error messages when i explicit said i don't want it.
We have to run r8 for multi-dex support
So maybe there should be option that automatically sets r8, when multidex is enabled? I've lost whole day to figure out whats going on, and why im getting errors abour r8 when option was disabled. If r8 is necessary part of muli-dex, then that info should be explicitly announced.
@PawKanarek I'm going to close, let me know if you have another issue here, thanks!
If this keeps coming up, we may need to figure out some better error messaging here. I think it could be more clear what needs fixing: Are you missing a NuGet package?
Ran into the same problem after upgrading to VS 16.5. My error is
2>R8 : warning : Missing class: com.samsung.android.fingerprint.FingerprintManager$EnrollFinishListener
2>R8 : warning : Missing class: com.samsung.android.fingerprint.FingerprintIdentifyDialog$FingerprintListener
2>R8 : warning : Missing class: com.samsung.android.fingerprint.IFingerprintClient$Stub
2>R8 : error : Compilation can't be completed because some library classes are missing.
Probably to do with the Plugin.Fingerprint package we are using but still annoying. As I understand it's detecting a real problem but I don't understand why it didn't popup when I did a release build with 16.4 and R8.
Oh right, so we just need to track down the missing Nugets? Mine says this..
10>R8 : warning : Missing class: org.conscrypt.ConscryptHostnameVerifier
10>R8 : warning : Missing class: androidx.paging.PositionalDataSource
Thanks Jonathan for replying. We haven't moved to AndroidX as yet but will look to in the release after next. Our regression is massive.
We followed these instructions:-
Try setting your project back to the current recommended defaults. For example, remove all of the following properties from the .csproj file via Notepad:
Activity
Anil-R commentedon Mar 18, 2020
Same issue facing R8 error in any mode (debug or release) even if code shrinker is set to none.
tried fixing this R8 issues with -dontwarn tag in proguard.cfg , cleaning sloution and deleting obj and bin folders and when ran application with debug mode throws error on app start up at MainActivity at base.OnCreate(bundle);
Same solution Working well on 16.4 after updating to 16.5 facing this issue.
** Please provide workaround as i am stuck, i cannot run my applications.
PawKanarek commentedon Mar 18, 2020
For now, my workaround is disabling R8/D8 in favor DX and proguard.
gugavaro commentedon Mar 18, 2020
@jonathanpeppers I remember you worked on something like this in the past is that correct?
jonathanpeppers commentedon Mar 18, 2020
We have to run
r8for multi-dex support. This will not be using the code shrinking functionality unless you haveAndroidLinkTool=r8.Unfortunately r8 complains with an error like this if it can't find all java types used by the app:
I suspect that a missing NuGet package could solve the problem. I'll try the sample, I am not hitting an error with an empty project.
jonathanpeppers commentedon Mar 18, 2020
@PawKanarek I installed
Xamarin.GooglePlayServices.Locationand the problem went away.Does
OneSignalneed to add that as a dependency for their NuGet package?PawKanarek commentedon Mar 18, 2020
@jonathanpeppers Thanks! As i said, error is only with com.onesignal nuget package installed. You don't need to try sample as i opened new issue for the OneSignal team. All my concerns for the Xamarin.Android were about R8 error messages when i explicit said i don't want it.
So maybe there should be option that automatically sets r8, when multidex is enabled? I've lost whole day to figure out whats going on, and why im getting errors abour r8 when option was disabled. If r8 is necessary part of muli-dex, then that info should be explicitly announced.
jonathanpeppers commentedon Mar 18, 2020
I suspect that if r8 is giving an error like this, OneSignal is actually missing some Java classes its using from Google Play Services.
I bet you get a crash at runtime if you use the right API from their SDK.
PawKanarek commentedon Mar 18, 2020
@jonathanpeppers You made my day! My project now runs on d8 and multi-dex. Thanks!
And what do you think about explicit setting r8 if multi-dex is enabled?
jonathanpeppers commentedon Mar 19, 2020
These are two different things. One is generating
classes.dex,classes2.dex, etc., and the other is stripping unused Java code.They invoke different command-line arguments, you can see how it works here:
https://github.com/xamarin/xamarin-android/blob/32df0048abd271e4246608f9458a7af1cf55893c/src/Xamarin.Android.Build.Tasks/Tasks/R8.cs#L55-L131
I agree it's confusing both these settings run r8...
jonathanpeppers commentedon Mar 19, 2020
@PawKanarek I'm going to close, let me know if you have another issue here, thanks!
If this keeps coming up, we may need to figure out some better error messaging here. I think it could be more clear what needs fixing:
Are you missing a NuGet package?GuidoNeele commentedon Mar 23, 2020
Ran into the same problem after upgrading to VS 16.5. My error is
Probably to do with the Plugin.Fingerprint package we are using but still annoying. As I understand it's detecting a real problem but I don't understand why it didn't popup when I did a release build with 16.4 and R8.
clintonrocksmith commentedon Mar 24, 2020
Oh right, so we just need to track down the missing Nugets? Mine says this..
10>R8 : warning : Missing class: org.conscrypt.ConscryptHostnameVerifier
10>R8 : warning : Missing class: androidx.paging.PositionalDataSource
jonathanpeppers commentedon Mar 25, 2020
I usually figure out the missing ones by searching the web.
@clintonrocksmith in your case, I think it might be one of these:
Hopefully, you are already using AndroidX.
But then I also found one of them is related to
okhttpand to ignore it?https://stackoverflow.com/questions/49880928/how-to-resolve-d8-warning-d8-type-org-conscrypt-conscrypt-was-not-found
Hopefully, you can actually ignore it. Does that one cause the build to fail?
clintonrocksmith commentedon Mar 25, 2020
Thanks Jonathan for replying. We haven't moved to AndroidX as yet but will look to in the release after next. Our regression is massive.
We followed these instructions:-
Try setting your project back to the current recommended defaults. For example, remove all of the following properties from the .csproj file via Notepad:
AndroidEnableMultiDex
AndroidDexGenerator
AndroidLinkTool
AndroidDexTool
This will let Xamarin.Android pick the current latest default values.