6

I'm getting an error on initializing map, when I try to use map as a external library and tried to make secondary, the apk is created and when I tried to launch map it crashes. But when I tried the same thing without dex it works fine (stacktrace is below).

How can I resolve this issue? I'm facing 65536 limit exceed error. So, it's 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)
Sam
  • 7,252
  • 16
  • 46
  • 65
Aman
  • 220
  • 3
  • 9

2 Answers2

1

It seems you use google-play-services.jar. The jar file does not include some resources.

Link the google-play-services_lib to your project.

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

Community
  • 1
  • 1
wf9a5m75
  • 6,100
  • 3
  • 25
  • 59
1

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

Here is link for developing 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 further information about 64k Limit at Jake Wharton's blog ; http://jakewharton.com/play-services-is-a-monolith/

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

Note: With API v21, this feature supported natively by Android.

Sinan Kozak
  • 3,236
  • 2
  • 26
  • 32