Async task not supporting in android 9.0 (Pie) - java

I was working on my code. it was working fine on version 8(Oreo) after that I got an update of android v 9.0 (Pie) and the app stopped working suddenly. after checking I got a error message om my Asyn task stating the below error:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.global.exch, PID: 25112
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:182)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:150)
at com.global.exch.Dataholder.getApi(Dataholder.java:100)
at com.global.exch.MainActivity$QuotesData.doInBackground(MainActivity.java:391)
at com.global.exch.MainActivity$QuotesData.doInBackground(MainActivity.java:386)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/base.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_resources_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:182) 
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:150) 
at com.global.exch.Dataholder.getApi(Dataholder.java:100) 
at com.global.exch.MainActivity$QuotesData.doInBackground(MainActivity.java:391) 
at com.global.exch.MainActivity$QuotesData.doInBackground(MainActivity.java:386) 
at android.os.AsyncTask$2.call(AsyncTask.java:333) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.global.exch-sEcnUuVsCYjXlnxJddVQAA==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
E/AndroidRuntime: at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:718)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:801)
at android.app.LoadedApk.getResources(LoadedApk.java:1023)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5780)
at android.app.ActivityThread.access$1100(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Can anyone help me out what is the exact issue for this as it was working fine earlier.
thank you in advance.

I was also facing the same issue but After Adding the below code in my manifest file the issue got resolved
for reference you can also check this url:
https://developer.android.com/about/versions/pie/android-9.0-changes-28
manifest.xml
<application
...
android:usesCleartextTraffic="true"
...>
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>

How to update the existing project in androidx.
does not need to add the extra permission & code, dependencies,...
0.1): changes into the compileSdkVersion 29
0.2): Refactor-> Migrate to androidX then
Just add the following code in the project "ASDF":
1): add the XML directory,
1.1): Add the following code in XML, Code is below: i.e.
<application
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
</network-security-config>
>
2): add the following code in the in manifest file:
2.1): within application tag the (manifest->application) add the following code:
android:networkSecurityConfig="#xml/network_security_config"
2.2): outside application tag the (manifest->application) add the following code:
<application>
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>
be happy and share your feedback with me Thank you**

Related

Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException)

I am using video_player: any in flutter. I am using https server url. All things are working fine, I am able to call api, load images but when I try to load video, I am getting this errors.
E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: Source error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:580)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:346)
at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1016)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:417)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:239)
at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:1471)
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:1415)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:1359)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:221)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:144)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:106)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:400)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:333)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:483)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:135)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:90)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:30)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:608)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:513)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:339)
at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84) 
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1016) 
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:417) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:668)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:513)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:432)
at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:360)
at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:89)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:224)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(ConscryptFileDescriptorSocket.java:430)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.NativeSsl.doHandshake(NativeSsl.java:387)
at com.a
E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
I have added security config as follows
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config>
<domain includeSubdomains="true">dxb.suphub.net</domain>
<trust-anchors>
<certificates src="#raw/my_ca"/>
</trust-anchors>
</domain-config>
</network-security-config>
and in Manifest file, I have added following command
android:networkSecurityConfig="#xml/network_security_config"
Still I am getting this error, Any help would be appreciated.
Thank you

error in android 9 protected doInBackground

I'm having trouble using these codes on Android 9 (work fine in lower versions)
Exits immediately and below error
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
Process: com.banehmall.application, PID: 2092
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/bind/DatatypeConverter;
at org.scribe.services.DatatypeConverterEncoder.encode(DatatypeConverterEncoder.java:10)
at org.scribe.services.HMACSha1SignatureService.bytesToBase64String(HMACSha1SignatureService.java:51)
at org.scribe.services.HMACSha1SignatureService.doSign(HMACSha1SignatureService.java:46)
at org.scribe.services.HMACSha1SignatureService.getSignature(HMACSha1SignatureService.java:32)
at org.scribe.oauth.OAuth10aServiceImpl.getSignature(OAuth10aServiceImpl.java:151)
at org.scribe.oauth.OAuth10aServiceImpl.addOAuthParams(OAuth10aServiceImpl.java:75)
at org.scribe.oauth.OAuth10aServiceImpl.signRequest(OAuth10aServiceImpl.java:126)
at com.ciyashop.library.apicall.PostApi$postAPiCall.doInBackground(PostApi.java:109)
at com.ciyashop.library.apicall.PostApi$postAPiCall.doInBackground(PostApi.java:40)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.bind.DatatypeConverter" on path: DexPathList[[zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/base.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_dependencies_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_resources_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_0_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_1_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_2_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_3_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_4_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_5_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_6_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_7_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_8_apk.apk", zip file "/data/app/com.banehmall.application-.
.
.
After adding this (commons-codec:commons-codec:1.10)library, app worked but the data is not received from the server and have
this log
E/Exception is: There was a problem while creating a connection to the remote service.
E/EGL_emulation: tid 2357: eglSurfaceAttrib(1354): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeb2e4dc0, error=EGL_BAD_MATCH
E/EGL_emulation: tid 2357: eglSurfaceAttrib(1354): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeb2e4e20, error=EGL_BAD_MATCH
E/getHomeDataResponse is: OAuthConnectionException
E/getHomeDataGson Exception is: Value OAuthConnectionException of type java.lang.String cannot be
converted to JSONObject
I/OpenGLRenderer: Davey! duration=899ms; Flags=0, IntendedVsync=1587234779362, Vsync=1587568112682,
OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1587582802287,
AnimationStart=1587582869695, PerformTraversalsStart=1587582992031, DrawStart=1587644518429,
SyncQueued=1587720147467, SyncStart=1587740410691, IssueDrawCommandsStart=1587740635430,
SwapBuffers=1588088691627, FrameCompleted=1588154607644, DequeueBufferDuration=199000,
QueueBufferDuration=417000,
thank you so mach
Hi i found the solution to this problem. In Android 9(28 and up)uses HTTPS ,if your server uses HTTP this error is happen. answer is writing the following code in the manifest
<application
.
.
.
android:usesCleartextTraffic="true">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
if not work use Invalidate Caches / Restart

java.lang.RuntimeException: Failure delivering result ResultInfo{...} to activity {....FacebookSignUp}: java.lang.NullPointerException:

In the Google Play Console pre-launch report, I the "STABILITY" section, I have this error that I need to fix:
Galaxy S9
Test ID: 2
Test Duration: 300 seconds
Model Name: Galaxy S9
Manufacturer: Samsung
Android Version: Android 8.0
Locale: es_US
Screen Size: 1080 × 2220
Screen Density (dpi): 480
RAM: 4096 MB
OpenGL ES Version: 3.2
Native Platform: armeabi-v7a
CPU Make: Qualcomm
CPU Model: SDM845
Issue: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
FATAL EXCEPTION: main
Process: [...], PID: 25180
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=32665, result=0, data=null} to activity {[...].FacebookSignUp}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4489)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4532)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at com.easy.facebook.android.facebook.FBLoginManager.loginSuccess(FBLoginManager.java:99)
at [...].FacebookSignUp.onActivityResult(FacebookSignUp.java:187)
at android.app.Activity.dispatchActivityResult(Activity.java:7539)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4485)
... 9 more
I suspect that this problem might be happening because my Facebook library is too old. In my app/build.gradle I am using this Facebook library:
implementation 'com.facebook.android:facebook-android-sdk:3.23.1'
I am sure it is very old and most likely deprecated in many ways. It still works though, but it might be the cause of this error that I see. Also, I am using this:
dependencies {
...
implementation files('libs/easyfacebookandroidsdk_2.3.jar')
....
}
That Facebook library must be the cause. Any ideas about fixing that NullPointerException that I see in the error? I guess the best should be for me to upgrade those very old Facebook libraries.
The problem was not Facebook. After examining the logs, the real problem was this:
E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: [package name], PID: 5893
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient;
at com.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.impl.client.DefaultHttpClient" on path: DexPathList[[zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/base.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_dependencies_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_0_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_1_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_2_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_3_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_4_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_5_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_6_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_7_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_8_apk.apk", zip file "/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.couponclub.Util.Util$1.run(Util.java:235)
at java.lang.Thread.run(Thread.java:764)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/[package name]-3cwAF4cAFytf561aNx4V2Q==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
The solution was to go include the following line inside of the <application> section of my AndroidManifest.xml:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
This is explained at https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p.

I am trying to launch nearby android master but give me this error

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.esri.android.nearbyplaces, PID: 28905
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.location.LocationServices.(Unknown Source:0)
at com.esri.android.nearbyplaces.places.PlacesFragment.setPresenter(PlacesFragment.java:154)
at com.esri.android.nearbyplaces.places.PlacesFragment.setPresenter(PlacesFragment.java:59)
at com.esri.android.nearbyplaces.places.PlacesPresenter.(PlacesPresenter.java:51)
at com.esri.android.nearbyplaces.places.PlacesActivity.onCreationComplete(PlacesActivity.java:224)
at com.esri.android.nearbyplaces.places.PlacesFragment.onCreate(PlacesFragment.java:90)
at android.support.v4.app.Fragment.performCreate(Fragment.java:2414)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418)
at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195)
at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078)
at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:117)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3273)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:620)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
at android.app.Activity.performStart(Activity.java:7157)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2937)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/base.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_dependencies_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_0_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_1_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_2_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_3_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_4_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_5_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_6_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_7_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_8_apk.apk", zip file "/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/lib/x86, /system/fake-libs, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/base.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.esri.android.nearbyplaces-eCjKJ8XXItZymb7jzSdP2g==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 33 more
In my case I faced this error when I was working with Facebook Account Kit API for Phone number authentication. I fixed it by adding these two dependencies:
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.1.0'
Maybe you might require to add any other similar dependency based on the services which you are using.

ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" after androidx migration

I'm trying to move to migrate to androidx. I used the migration tool in Android Studio. When I do this I get the following stacktrace when I run my app.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.peerke.outdoorpuzzlegame.debug, PID: 10901
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.peerke.outdoorpuzzlegame.debug-IBtFsngoLqc-cQb_hOO5wQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.peerke.outdoorpuzzlegame.debug-IBtFsngoLqc-cQb_hOO5wQ==/lib/x86, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:6376)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5932)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5847)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6649)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.peerke.outdoorpuzzlegame.debug-IBtFsngoLqc-cQb_hOO5wQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.peerke.outdoorpuzzlegame.debug-IBtFsngoLqc-cQb_hOO5wQ==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:62)
at android.app.ActivityThread.installProvider(ActivityThread.java:6360)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5932) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5847) 
at android.app.ActivityThread.access$1000(ActivityThread.java:198) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6649) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826) 
The exception is correct. android.support.v4.content.FileProvider doesn't exist in my app. But androidx.core.content.FileProvider is included in my app.
The big question is why does it want to load the old version of FileProvider?
Thanks to #CommonsWare
More explanation:
What to do, find the android.support.v4.FileProvider in your <provider> in AndroidManifest.xml.
Change it to androidx.core.content.FileProvider
In manifiest.xml file simply change this
<provider
android:name="android.support.v4.content.FileProvider"
.....
</provider>
To this one
<provider
android:name="androidx.core.content.FileProvider"
......
</provider>
Or Simply
Go to Refactor (Studio -> Menu -> Refactor)
Click the Migrate to AndroidX.
it's working.
why does it want to load the old version of FileProvider?
Based on the stack trace, perhaps you are still using the old package name in the <provider> element in the manifest.

Categories