New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError when targetSdk=28 #200

Closed
seventhmoon opened this Issue Jun 7, 2018 · 7 comments

Comments

Projects
None yet
7 participants
@seventhmoon
Copy link

seventhmoon commented Jun 7, 2018

Recent behavior change in P will affect this library.

An app can be affected if it uses a non-standard ClassLoader that explicitly delegates to the system ClassLoader. These apps need to delegate to the app ClassLoader instead when looking for classes in org.apache.http.*. If they delegate to the system ClassLoader, the apps will fail on Android P with a NoClassDefFoundError, because those classes are no longer known to the system ClassLoader. To prevent similar problems in the future, apps should in general load classes through the app ClassLoader rather than accessing the system ClassLoader directly.

https://developer.android.com/preview/behavior-changes#apache-nonp

Application with this lib and targets P will be affected.

E/AndroidRuntime:` FATAL EXCEPTION: Thread-6
Process: com.androidfung.geoip, PID: 26781
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at el.b(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):3)
at ek.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):4)
at em.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):51)
at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):11)
at dw.a(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):16)
at dw.run(:com.google.android.gms.dynamite_mapsdynamite@12848063@12.8.48 (100408-196123505):61)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/system/priv-app/PrebuiltGmsCorePi/app_chimera/m/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000006/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:126)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader@12848063@12.8.48 (100408-196123505):25)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

@seventhmoon seventhmoon closed this Jun 7, 2018

@edenman

This comment has been minimized.

Copy link

edenman commented Jun 25, 2018

@seventhmoon did you find a workaround for this? I'm running into the same issue but I don't use Volley in my app.

@edenman

This comment has been minimized.

Copy link

edenman commented Jun 25, 2018

nevermind, found workaround on https://issuetracker.google.com/issues/79478779

@lawloretienne

This comment has been minimized.

Copy link

lawloretienne commented Jul 10, 2018

Yep the workaround in the google issue tracker (https://issuetracker.google.com/issues/79478779) worked

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

@vikas0

This comment has been minimized.

Copy link

vikas0 commented Nov 14, 2018

how to put this in the code?

@barotia

This comment has been minimized.

Copy link

barotia commented Nov 16, 2018

@vikas0 In manifest, in application tag.

@altairmizuchi

This comment has been minimized.

Copy link

altairmizuchi commented Nov 27, 2018

Hello everyone! This has not helped in my case. Is there any special place inside an tag where I should place uses-library?

@mumu007

This comment has been minimized.

Copy link

mumu007 commented Jan 17, 2019

Hello everyone! This has not helped in my case. Is there any special place inside an tag where I should place uses-library?

application tag in AndroidManifest.xml @altairmizuchi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment