My projects Map activity is not working
I just pasted the api key in place google_maps_api.xml
and clicked run
Logcat:
E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.appmy.lofind, PID: 10901
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at el.b(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):3)
at ek.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):4)
at em.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):51)
at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):11)
at dw.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):16)
at dw.run(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):61)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/system/priv-app/PrebuiltGmsCore/app_chimera/m/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000006/MapsDynamite.apk!/lib/x86, /system/lib]]
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#12848026#12.8.48 (040700-196123505):25)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at el.b(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):3)
at ek.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):4)
at em.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):51)
at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):11)
at dw.a(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):16)
at dw.run(:com.google.android.gms.dynamite_mapsdynamite#12848026#12.8.48 (040700-196123505):61)
E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
I've found another solution at
Android Google maps java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion
Just add this in your manifest:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Update:
Starting from Google Maps SDK version 16.1.0 you can skip adding the solution above as the tag has been added to the AndroidManifest of the maps library.
https://developers.google.com/maps/documentation/android-sdk/releases#2019-02-06
Added the following declaration to the AndroidManifest.xml to support
the Apache HTTP client on Android P and above. After updating to
com.google.android.gms:play-services-maps:16.1.0 you can remove this
line from your own AndroidManifest.xml. (Issue 117591497)
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
The same problem here when using target SDK 28. Reverting to SDK 27 solved the problem.
Don't revert your target SDK.
Better use this solution https://stackoverflow.com/a/50944537/5710605
Put this in the Manifest tag:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
More info: https://issuetracker.google.com/issues/79478779
as google documentation said:
If you are using com.google.android.gms:play-services-maps:16.0.0 or
below and your app is targeting API level 28 (Android 9.0) or above,
you must include the following declaration within the
element of AndroidManifest.xml.
Related
I added the package to my app putting the meta data with the API key and all that and it was working ok so I started working on other parts of my app and when I tried to use it again some time later it started giving me this exception:
Unhandled Exception: Platform Exception(error, java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml
its telling me to add the following to my AndroidManifest.xml:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
however i didn't need this line before and it was working just fine, why is it asking for it out of nowhere? I added it but now its crashing whenever it tries to load the map saying FATAL EXCEPTION: Thread-3. Can anyone help please?
It looks like you are using some kind of Google Mobile Services (GMS) APIs in your app. Google Maps API is one of them. As the error suggests, just add the meta-data to your AndroidManifest.xml to solve the problem. If you read the docs on how to properly set up Google Maps API or other GMS APIs in your app, you can find that you have to define the meta-data on AndroidManifest.xml as well.
Hope this helps.
I have a problem with MapView. My map was loaded correctly until I used "targetSdkVersion 19", but since I updated to "targetSdkVersion 29" every time I launch the map activity, the app crashes.
Can anyone tell me what the problem might be?
2019-08-29 17:04:05.679 29021-29119/mcsistemi.tentatavendita E/AndroidRuntime: FATAL EXCEPTION: Thread-8
Process: mcsistemi.tentatavendita, PID: 29021
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at ce.b(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):3)
at cb.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):3)
at cd.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):14)
at com.google.maps.api.android.lib6.drd.ak.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):4)
at bf.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):22)
at bf.run(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):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/000000c6/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/000000c6/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#19056081#19.0.56 (100400-262933554):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at ce.b(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):3)
at cb.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):3)
at cd.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):14)
at com.google.maps.api.android.lib6.drd.ak.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):4)
at bf.a(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):22)
at bf.run(:com.google.android.gms.dynamite_mapsdynamite#19056081#19.0.56 (100400-262933554):8)
Add this under <application> tag in Manifest.xml
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
With Android 6.0, we removed support for the Apache HTTP client.
Beginning with Android 9, that library is removed from the
bootclasspath and is not available to apps by default.
To continue using the Apache HTTP client, apps that target Android 9
and above can add the above line to their AndroidManifest.xml:
Here is more info
by Google
Since you say it started after android sdk 29, the problem could also be from the fact that you haven't changed your mappings to the current androidx mappings in the layout file that bring up this problem
If there is a library call like android.support.v7.widget.CardView in your layout causing the problem, you must change it to androidx.cardview.widget.CardView in android X and sdk 29 upwards..
For more mappings and how its currently written in the layout files, kindly check this link for the other class mappings https://developer.android.com/jetpack/androidx/migrate/class-mappings
I have a Unity3D game published on Android, and it have worked well so far.
However, the Android Vitals Dashboard is now reporting a lot of crashes. Here's the detailed info:
By Android version: Android 9 4500 100.0%
Stacktrace:
java.lang.Error: FATAL EXCEPTION [Thread-360]
Unity version : 2017.3.1p3
Device model : Google Pixel
Device fingerprint: google/sailfish/sailfish:9/PQ2A.190305.002/5240760:user/release-keys
Caused by
at lt.b (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:2)
at ls.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:1)
at lu.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:18)
at com.google.android.gms.ads.internal.util.ar.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:10)
at kx.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:7)
at kx.run (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:2)
Caused by: java.lang.ClassNotFoundException:
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#16089081#16.0.89 (100400-239467275):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
My AndroidResolverDependencies.xml file:
<dependencies>
<packages>
<package>com.android.support:customtabs:[26.0.0, 27.2.0[</package>
<package>com.android.support:support-v4:[26.0.0, 27.2.0[</package>
<package>com.google.android.gms:play-services-ads:17.2.0</package>
<package>com.google.android.gms:play-services-analytics:11.8.0</package>
<package>com.google.android.gms:play-services-base:[10.2.1, 12.1.0[</package>
<package>com.google.android.gms:play-services-location:[10.2.1, 12.1.0[</package>
<package>com.google.firebase:firebase-messaging:[10.2.1, 12.1.0[</package>
</packages>
<files>
<file>Assets/Plugins/Android/android.arch.core.common-1.1.0.jar</file>
<file>Assets/Plugins/Android/android.arch.core.runtime-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.common-1.1.0.jar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.livedata-core-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.runtime-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.viewmodel-1.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.customtabs-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-annotations-27.1.1.jar</file>
<file>Assets/Plugins/Android/com.android.support.support-compat-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-ui-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-utils-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-fragment-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-media-compat-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-v4-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-impl-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-base-16.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-basement-16.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-gass-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-location-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-16.3.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-16.3.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-places-placereport-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-stats-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-tagmanager-v4-impl-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-tasks-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.auto.value.auto-value-annotations-1.6.jar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-common-16.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-iid-17.1.2.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-measurement-connector-17.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-messaging-17.6.0.aar</file>
</files>
</dependencies>
Target API level: 28
Minimum API level: 16
I've seen a similar thread in Google AdMob's discussion group suggesting to add the following to the AndroidManifest.xml file:
<uses-library android:name="org.apache.http.legacy" android:required="false" />
However:
I'm not sure the problem is caused by any apache-related API.
I'm afraid this will restrict the number of installs in my app since it will be available to a smaller audience in Google Play due to the uses-library declaration.
As per Behavior changes: apps targeting API level 28+
Apache HTTP client deprecation
With Android 6.0, we removed support for the Apache HTTP client.
Beginning with Android 9, that library is removed from the
bootclasspath and is not available to apps by default. To continue using the Apache HTTP client, apps that target Android 9 and above can add the following to their AndroidManifest.xml:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Note: The android:required="false" attribute is required for apps that
have a minimum SDK of 23 or lower, because on devices with API levels
lower than 24, the org.apache.http.legacy library is not available.
(On those devices, the Apache HTTP classes are available on the
bootclasspath.)
As an alternative to using the runtime Apache library, apps can bundle
their own version of the org.apache.http library in their APK. If you
do this, you must repackage the library (with a utility like Jar Jar)
to avoid class compatibility issues with the classes provided in the
runtime.
I have following error in Android 9 (Pie) I don't get where is the error I think its related to google gms libs.
java.lang.NoClassDefFoundError:
at fa.b (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):3)
at ez.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):3)
at fb.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):15)
at com.google.maps.api.android.lib6.drd.al.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):6)
at ee.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):21)
at ee.run (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):8)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:169)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ac.loadClass (com.google.android.gms.dynamite_dynamiteloader#14574081#14.5.74 (100400-219897028):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
Here is official docs
If you are using com.google.android.gms:play-services-maps:16.0.0 or
below and your app is targeting API level 28 (Android 9.0) or above,
you must include the following declaration within the
element of AndroidManifest.xml.
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
This is handled for you if you are using
com.google.android.gms:play-services-maps:16.1.0 and is not necessary
if your app is targeting a lower API level.
and also add this tag in Menifest.xml
<application
.....
.....
android:usesCleartextTraffic="true">
if you are using send and received request to server like (Volley , retrofit and Http request)
Also try this one (optional)
convert the project to AndroidX make sure backup of project first.
I have created and published an application on the market...
However, on the market page it says: "Version required 1.0" while I know it needs at least version 2.0 (level 8) as it uses google maps..
I know that I have to include in the manifest file something like this:
I have tried to change the number 1 for another, but if I do it, the app crashes straight away with the following message:
android.view.InflateException: Binary XML file line #154: Error inflating class
Has anybody came across something similar?
Thanks
In your AndroidManifest.xml file, you need to include android:minSdkVersion and <uses-sdk> element. For example, I have this in my AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:minSdkVersion="4"
...
>
...
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="7"/>
...
</manifest>
Have a look here for more details: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html