Google v2 map initialization error on the additional dex android mechanism

I get an error when initializing the map, when I try to use the map as an external library and try to make a secondary one, apk is created, and when I tried to start the map, it worked. But when I tried the same without dex, it works fine (stacktrace below).

How can I solve this problem? I encountered exceeding the limit of 65536. So, this is the only way to create apk, and I'm using ant.

java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable 10-06 22:20:24.374: E/AndroidRuntime(17015): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source) 10-06 22:20:24.374: E/AndroidRuntime(17015): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source) 10-06 22:20:24.374: E/AndroidRuntime(17015): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291) 10-06 22:20:24.374: E/AndroidRuntime(17015): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 
+6
source share
2 answers

You seem to be using google-play-services.jar. The jar file does not contain some resources.

Link google-play-services_lib to your project.

java.lang.NoClassDefFoundError: com.google.android.gms.R $ styleable in android

+1
source

If you use eclipce, import the Google Play services from your SDK into the workspace and add as a library. If you are using Android Studio, add gradle to this as dependecies. compile 'com.google.android.gms: play-services: 6.1. + '

Here is a link for development with Google Play Services: http://developer.android.com/google/play-services/setup.html

You cannot use jar file for Google Play services.

You can find more information about 64k Limit on the Jake Wharton Blog; http://jakewharton.com/play-services-is-a-monolith/

Also with the release of Android 5.0, Lolipop google will release the MultiDexApplication library. You should try it. http://developer.android.com/reference/android/support/multidex/MultiDexApplication.html

Note. With API v21, this feature is supported by Android.

+1
source

Source: https://habr.com/ru/post/976309/


All Articles