I am trying to create an application which utilizes Google Maps API. I followed the instructions (installed Google Play Services, created an API key, copied, and then pasted it in .xml file), but when I try to run this app, I get "Maps Demo (the name of the app) keeps stopping" message. (I use Nexus 5 API 28 AVD as an emulator) What might be reasons for that and how to solve this problem?
Logcat:
--------- beginning of crash
2018-11-24 09:07:55.191 2653-2803/? E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: com.example.user.mapdirectionsample, PID: 2653
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at fa.b(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):3)
at ez.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):3)
at fb.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):6)
at ee.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):21)
at ee.run(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):8)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000000d/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000000d/MapsDynamite.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ac.loadClass(:com.google.android.gms.dynamite_dynamiteloader#14574084#14.5.74 (100700-219897028):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at fa.b(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):3)
at ez.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):3)
at fb.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):6)
at ee.a(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):21)
at ee.run(:com.google.android.gms.dynamite_mapsdynamite#14574084#14.5.74 (100700-219897028):8)
Thanks in advance.
Related
I am trying to make an HTTP call to a server to get its HTML contents everything is working fine on other android versions. But in android 6 when the app is calling HTMLunit it crashes.
I know it has to do with something that works on API above 23. but not on the 23.. I tried many things but I sill can't fix it...
Why it's important to run the app on android 6:
A big number of my users is using android 6 and 5
The error:
FATAL EXCEPTION: Thread-9255
Process: bd.maruf.myapplication, PID: 7773
java.lang.NoClassDefFoundError: java.util.function.Supplier
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:476)
at java.lang.reflect.Method.getReturnType(Method.java:183)
at java.lang.Class.getDeclaredMethods(Class.java:678)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:212)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:193)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:67)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:685)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:701)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:161)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:326)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:275)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:265)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:257)
at bd.maruf.myapplication.MainActivity.main(MainActivity.kt:32)
at bd.maruf.myapplication.MainActivity.onCreate$lambda$1$lambda$0(MainActivity.kt:22)
at bd.maruf.myapplication.MainActivity.$r8$lambda$VtPJx1mT1BVGpp5vWQWqcx_e4kM(MainActivity.kt)
at bd.maruf.myapplication.MainActivity$$ExternalSyntheticLambda2.run(D8$$SyntheticClass)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.function.Supplier" on path: DexPathList[[zip file "/data/app/bd.maruf.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/bd.maruf.myapplication-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
at java.lang.Class.getDexCacheType(Class.java:476)
at java.lang.reflect.Method.getReturnType(Method.java:183)
at java.lang.Class.getDeclaredMethods(Class.java:678)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:212)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:193)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:67)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:685)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:701)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:161)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:326)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:275)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:265)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:257)
at bd.maruf.myapplication.MainActivity.main(MainActivity.kt:32)
at bd.maruf.myapplication.MainActivity.onCreate$lambda$1$lambda$0(MainActivity.kt:22)
at bd.maruf.myapplication.MainActivity.$r8$lambda$VtPJx1mT1BVGpp5vWQWqcx_e4kM(MainActivity.kt)
at bd.maruf.myapplication.MainActivity$$ExternalSyntheticLambda2.run(D8$$SyntheticClass)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: java.util.function.Supplier
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 20 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2022-11-12 18:11:50.861 7773-7807 Surface bd.maruf.myapplication D Surface::disconnect(this=0xaddb7b00,api=1)
what I have tried :
cleaning and rebuilding that project
adding:
defaultConfig { multiDexEnabled true}
dependencies {implementation 'com.android.support:multidex:1.0.3'
3. deleting .gradel and .idea file
java.util.function.Supplier is documented as "Added in API level 24", hence code requiring it will not work on pre 24 SDK due to class absence.
Will try to solve this in HtmlUnit - check https://github.com/HtmlUnit/htmlunit-android/issues/9 or https://twitter.com/htmlunit for progress.
After some analysis and experiments i decide to not fix this. The js engine (Rhino) uses classes from the java.util.function package. Changing this is not a simple task and there are many other thinks to do.
So sorry, but i like to stay with android 7 as minimum requirement.
I followed the official instructions to Add an AAR as a dependency.
The build.gradle of the app has:
implementation files('libs/androidLibrary-release.aar')
The app builds and starts fine. However, it crashes when it uses a method of the library with the following in the logcat:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/joda/time/DateTime;
at net.mydomain.android.utility.getCurrentTime(SourceFile:1)
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.joda.time.DateTime" on path: DexPathList[[zip file "/data/app/com.mydomain.foo-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
...
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Method getCurrentTime() uses joda-time. The library has the following in its build.gradle:
implementation 'joda-time:joda-time:2.10.5'
I also tried api as follows to no avail:
api 'joda-time:joda-time:2.10.5'
Could anyone offer a tip to help find the culprit?
I used to import aar libraries as modules and they worked flawlessly. I have just updated Android Studio to Arctic Fox and the option to import an aar library is no longer available.
I am fairly new to android app development. Today i tried to implement a map inn my app, and cannot make it work. I even tried to make a new app with the default map activity, which crashes instantly.
This is the error I am getting:
--------- beginning of crash
2018-12-25 23:03:24.440 8401-8428/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.krist.maptest, PID: 8401
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):8)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/00000016/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000016/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader#14799081#14.7.99 (100400-223214910):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99
(100400-223214910):8)
I am running on a Pixel 3XL with the latest updates. Any ideas what the issue might be? Thanks.
I also had same issue, and it was solved pasting this line of code to 'application' element of AndroidManifest.xml.
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Hope it helped you.
Check if dependencies are set up correctly. Play services and gmaps versions should not vary.
Enable multidexing in your build.
add this line in dependencies:
implementation 'com.android.support:multidex:1.0.3' and make these changes in defaultConfig:
android {
defaultConfig {
...
multiDexEnabled true
}
...
}
And sync project.
I make a project and test it.
I test in my device Galaxy S7(Mashmellow), it works fine, but another device SHV-205(Kitkat), it occurs error like this.
09-23 15:24:45.981 10438-10438/com.thewell.thewell_dev.companylink E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.thewell.thewell_dev.companylink, PID: 10438
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.thewell.thewell_dev.companylink/com.thewell.thewell_dev.fourslink.Activity.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.thewell.thewell_dev.fourslink.Activity.SplashActivity" on path: DexPathList[[zip file "/data/app/com.thewell.thewell_dev.companylink-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.thewell.thewell_dev.companylink-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
I use android studio.
I test it and upload to Google play store, but it works fine.
I don't know why this problem occurs this error.
please help me
I faced this Error already, and found the solution myself,
If you are placed you splashscreen activity in your Activity package, please move it to outer package(Main package)
as shown in below Image..!
Compiled an APK and tested it successfully on my device, tried it through the Google Play Store and it stops working immediately. This app is a copy of an existing app, since you cannot have the same package name twice I simply renamed the package name in the AndroidManifest.xml, compiled it, tested it and then uploaded it to the Play Store.
I do not understand why the app works when I copy it to a device but the same app fails when loaded through the Play Store. I generated a crash report which I accessed from the Play Store Developer Console. If anyone has experience of successfully duplicating apps on the Store then your help would be appreciated.
java.lang.RuntimeException: Unable to instantiate application de.schildbach.wallet.artbyte.WalletApplication: java.lang.ClassNotFoundException: Didn't find class "de.schildbach.wallet.artbyte.WalletApplication" on path: DexPathList[[zip file "/data/app/de.schildbach.wallet.artbyte-1/base.apk"],nativeLibraryDirectories=[/data/app/de.schildbach.wallet.artbyte-1/lib/arm, /data/app/de.schildbach.wallet.artbyte-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:680)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395)
at android.app.ActivityThread.access$1800(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "de.schildbach.wallet.artbyte.WalletApplication" on path: DexPathList[[zip file "/data/app/de.schildbach.wallet.artbyte-1/base.apk"],nativeLibraryDirectories=[/data/app/de.schildbach.wallet.artbyte-1/lib/arm, /data/app/de.schildbach.wallet.artbyte-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:1005)
at android.app.LoadedApk.makeApplication(LoadedApk.java:670)
... 9 more
Suppressed: java.lang.ClassNotFoundException: de.schildbach.wallet.artbyte.WalletApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
The Exception says that build is failed due to class not found on dex path list. Build the apk by cleaning the project and also recompile the native code using the ndk-build command. Then try it on the local device and then upload to play store.
The package name in AndroidManifest.xml is often also used for the code base, e.g. as class name of the activities. If you only rename the package name but leave the Java/dex code unchanged Android will not be able to find some classes as you already have noticed.
Check the AndroidManifest.xml for package relative class names (those that start with a .) and prepend the old package name:
Example
Old package name: org.example.myapp
Old activity name: <activity android:name=".MyActivity" ..>
New package name: com.example.newappname
New activity name: <activity android:name="org.example.myapp.MyActivity" ..>