Forum Xamarin Xamarin.Android

Can't enable D8: Missing class: com.android.internal.util.Predicate

Hi!
I was in need of enabling R8 in our project in order to use a video component that requires Java 8, but can't because we get the following error at compile-time:
R8: Compilation can't be completed because some library classes are missing.
There's a warning that says:
Missing class: com.android.internal.util.Predicate
that, from what understand, must be the cause of the issue. Thing is, when I google it, all I learn is that that class is… deprecated, or something?

Any help or tip would be deeply appreciated.
Thank you!

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    First of all, you change try to switch the R8 to D8

    Then add <uses-library android:name="org.apache.http.legacy" android:required="false" /> in your AndroidManifest.xml If this issue is disappear?

    If you still get the same question, Did you enabled the proguard, please add the following lines to your proguard.cfg

    -keep class com.android.internal.util.Predicate

  • Atharos1Atharos1 Member ✭✭
    edited October 2019

    The problen is with D8, not R8, I mispelled it. There is no code reduction going on, so no Proguard or anything weird just yet.
    I did as instructed, placing inside the Application tag in the manifest, but the error persists. Still complains about missing com.android.internal.util.Predicate D:

    I'm getting kind of desperate, I really don't know how to proceed. Google revealed nothing (that's a new one), so if anyone can send me on the right direction, I would really appreciate it.

    EDIT: disabling Multidex seems to let me run the app with D8 enabled, but this isn't a long term solution as I need to assume I will hit the Dex limit eventually. I hope this info is useful.

    Thanks por the quick response!

  • RogerSchmidlinRogerSchmidlin CHUniversity ✭✭✭

    I tried all that from your post, but didn't work for me. I looks like that D8 is now the default value in a Xamarin project.
    My error:
    /Users/schmiddyman/Projects/HAPP_NextGeneration/PowerPlan.Droid/R8: Error: Compilation can't be completed because some library classes are missing. (PowerPlan.Droid)
    If I leave it to dx it builds fine but then I cannot load it on a device.
    My error:
    Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_INVALID_APK: Scanning Failed.: Package /data/app/com.horizonpower.happ-2ZdC9_Wx2GBqs02qFgUX4A==/base.apk code is missing]

    I am stuck because I can't use my android devices anymore. Any ideas?

Sign In or Register to comment.