Google Maps api v2 class not found - android

I am using google maps api v2 and everything was working fine . today morning i updated the sdk and now maps are not working. Tried a lot of things like importing the lib project again and all but nothing seems to work . Plz help.
This is the logcat output
05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method com.apptree.de_luxe.InfoActivity.<clinit>
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 170 (Lcom/google/android/gms/maps/model/LatLng;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0000
05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method com.apptree.de_luxe.InfoActivity.setUpMap
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 172 (Lcom/google/android/gms/maps/model/MarkerOptions;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0002
05-16 08:53:34.347: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.MapFragment', referenced from method com.apptree.de_luxe.InfoActivity.setUpMapIfNeeded
05-16 08:53:34.347: W/dalvikvm(3422): VFY: unable to resolve check-cast 169 (Lcom/google/android/gms/maps/MapFragment;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.357: D/dalvikvm(3422): VFY: replacing opcode 0x1f at 0x000f
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029b at 0x0c in Lcom/apptree/de_luxe/InfoActivity;.<clinit>
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029c at 0x04 in Lcom/apptree/de_luxe/InfoActivity;.setUpMap
05-16 08:53:34.387: W/dalvikvm(3422): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.387: W/dalvikvm(3422): Class init failed in newInstance call (Lcom/apptree/de_luxe/InfoActivity;)
05-16 08:53:34.387: D/AndroidRuntime(3422): Shutting down VM
05-16 08:53:34.398: W/dalvikvm(3422): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
05-16 08:53:34.457: E/AndroidRuntime(3422): FATAL EXCEPTION: main
05-16 08:53:34.457: E/AndroidRuntime(3422): java.lang.ExceptionInInitializerError
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.Class.newInstanceImpl(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.Class.newInstance(Class.java:1319)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.os.Looper.loop(Looper.java:137)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.reflect.Method.invoke(Method.java:511)
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-16 08:53:34.457: E/AndroidRuntime(3422): at dalvik.system.NativeStart.main(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.apptree.de_luxe.InfoActivity.<clinit>(InfoActivity.java:35)
05-16 08:53:34.457: E/AndroidRuntime(3422): ... 15 more

In Eclipse go to:
"Project" -> "Properties" -> "Java Build Properties"
On the "Order and Export" tab I checked "Android Private Libraries" on my project. I also did this for the library project it references. This fixed my class not found errors following upgrading to SDK 22.

You should refer the google play services library project in your map project.
Import your library project to your worksace. import the same to eclipse.
Right click on your project. goto properties. Choose android. click android. browse and add the library project.

Related

Android AWS CognitoCachingCredentialsProvider crashes app in API 17 - JellyBean

I'm having a problem running my app on older versions of Android because i get an error when trying to instantiate CognitoCachingCredentialsProvider.
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
this,
this.getString(R.string.identity_pool_id),
Regions.DEFAULT_REGION);
This works on Lollipop 5.0, although it crashes my app on Jellybean 4.4.2 (API 17). I haven't tried other versions of Android yet because i need it to work on Jellybean and above.
Does anyone know why this would give me an error on Jellybean and not Lollipop? The code does not go to my try/catch block in Jellybean, instead it just kills the app and Logcat provides this error:
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: FATAL EXCEPTION: main
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: java.lang.VerifyError: com/amazonaws/auth/CognitoCachingCredentialsProvider
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at au.appsprout.com.dropmap.Start.onCreate(Start.java:38)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:141)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5041)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
Found the solution. It was to do with MultiDex not working on older versions of Android (before Lollipop). Here is a link to the solution for anyone with this problem: Unable to execute dex: method ID not in [0, 0xffff]: 65536

Android Maps v2 Stopped Working

I've had Google Maps v2 up and running for months, no code has changed, and now every fragment with a MapFragment crashes when attached. (Building without proguard and signing with debug key)
I am guessing that it has to do with Play Services, because it appeared to work after re-installing the Play Services updates. But now it crashes again, even with re-installing. This occurs on two Samsung Note 8s, a Note 3, a Note 1, and a Nexus 5.
I have tried clean builds and regenerating the Maps API with a different Google APIs account.
I've included the necessary bits in my AndroidManifest:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/app_id_maps"/>
I include the following xml in the my fragment layouts:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
map:mapType="normal"
map:uiCompass="true"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="false"
map:uiZoomGestures="true"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Logcat:
07-31 08:23:57.721 31926-31926/com.packagename I/u﹕ Making Creator dynamically
07-31 08:23:57.731 31926-31926/com.packagename I/Google Maps Android API﹕ Google Play services client version: 5077000
07-31 08:23:57.731 31926-31926/com.packagename I/dalvikvm﹕ Could not find method guj.a, referenced from method gqi.a
07-31 08:23:57.731 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve static method 24936: Lguj;.a (Landroid/content/Context;)Lgri;
07-31 08:23:57.731 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0003
07-31 08:23:57.731 31926-31926/com.packagename E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-31 08:23:57.731 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-31 08:23:57.731 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-31 08:23:57.736 31926-31926/com.packagename E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-31 08:23:57.736 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-31 08:23:57.736 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-31 08:23:57.736 31926-31926/com.packagename E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-31 08:23:57.736 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-31 08:23:57.736 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-31 08:23:57.736 31926-31926/com.packagename D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-31 08:23:57.736 31926-31926/com.packagename D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0c in Lgps;.a
07-31 08:23:57.736 31926-31926/com.packagename D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-31 08:23:57.741 31926-31926/com.packagename I/Google Maps Android API﹕ Google Play services package version: 5084030
07-31 08:23:57.746 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve static field 20873 (t) in Lyp;
07-31 08:23:57.746 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x000e
07-31 08:23:57.746 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve static field 20873 (t) in Lyp;
07-31 08:23:57.746 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x000d
07-31 08:23:57.846 31926-31926/com.packagename I/dalvikvm﹕ Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lgln;'
07-31 08:23:57.846 31926-31926/com.packagename W/dalvikvm﹕ Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
07-31 08:23:57.846 31926-31926/com.packagename E/dalvikvm﹕ Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
07-31 08:23:57.846 31926-31926/com.packagename W/dalvikvm﹕ VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt;
07-31 08:23:57.846 31926-31926/com.packagename D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x0019
07-31 08:23:57.886 31926-31926/com.packagename D/dalvikvm﹕ GC_FOR_ALLOC freed 3142K, 31% free 10122K/14616K, paused 19ms, total 19ms
07-31 08:23:57.901 31926-31926/com.packagename D/AbsListView﹕ Get MotionRecognitionManager
07-31 08:23:57.916 31926-32063/com.packagename A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 32063 (DataRequestDisp)
07-31 08:23:57.921 31926-31926/com.packagename D/ProgressBar﹕ setProgressDrawable drawableHeight = 0
07-31 08:23:57.921 31926-31926/com.packagename D/AbsSeekBar﹕ AbsSeekBar Constructor: misSeebarAnimationAvailable = false
07-31 08:23:57.956 31926-31926/com.packagename W/GmsClientEvents﹕ registerConnectionCallbacks(): listener com.google.android.gms.internal.hc$c#429b29d0 is already registered
07-31 08:23:58.011 31926-31926/com.packagename D/ProgressBar﹕ updateDrawableBounds: left = 0
07-31 08:23:58.011 31926-31926/com.packagename D/ProgressBar﹕ updateDrawableBounds: top = 0
07-31 08:23:58.011 31926-31926/com.packagename D/ProgressBar﹕ updateDrawableBounds: right = 64
07-31 08:23:58.011 31926-31926/com.packagename D/ProgressBar﹕ updateDrawableBounds: bottom = 64
On Samsung devices I also get this stacktrace:
07-31 08:23:57.656 31926-31926/com.packagename W/dalvikvm﹕ No implementation found for native Ldalvik/system/VMRuntime;.pauseGc:(Ljava/lang/String;)I
07-31 08:23:57.661 31926-31926/com.packagename E/ActivityThread﹕ Pause GC
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Native method not found: dalvik.system.VMRuntime.pauseGc:(Ljava/lang/String;)I
at dalvik.system.VMRuntime.pauseGc(Native Method)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)

Google Map does not load on emulator with Jelly Bean 4.3 [duplicate]

I am using google maps api v2 and everything was working fine . today morning i updated the sdk and now maps are not working. Tried a lot of things like importing the lib project again and all but nothing seems to work . Plz help.
This is the logcat output
05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method com.apptree.de_luxe.InfoActivity.<clinit>
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 170 (Lcom/google/android/gms/maps/model/LatLng;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0000
05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method com.apptree.de_luxe.InfoActivity.setUpMap
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 172 (Lcom/google/android/gms/maps/model/MarkerOptions;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0002
05-16 08:53:34.347: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.MapFragment', referenced from method com.apptree.de_luxe.InfoActivity.setUpMapIfNeeded
05-16 08:53:34.347: W/dalvikvm(3422): VFY: unable to resolve check-cast 169 (Lcom/google/android/gms/maps/MapFragment;) in Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.357: D/dalvikvm(3422): VFY: replacing opcode 0x1f at 0x000f
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029b at 0x0c in Lcom/apptree/de_luxe/InfoActivity;.<clinit>
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029c at 0x04 in Lcom/apptree/de_luxe/InfoActivity;.setUpMap
05-16 08:53:34.387: W/dalvikvm(3422): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/apptree/de_luxe/InfoActivity;
05-16 08:53:34.387: W/dalvikvm(3422): Class init failed in newInstance call (Lcom/apptree/de_luxe/InfoActivity;)
05-16 08:53:34.387: D/AndroidRuntime(3422): Shutting down VM
05-16 08:53:34.398: W/dalvikvm(3422): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
05-16 08:53:34.457: E/AndroidRuntime(3422): FATAL EXCEPTION: main
05-16 08:53:34.457: E/AndroidRuntime(3422): java.lang.ExceptionInInitializerError
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.Class.newInstanceImpl(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.Class.newInstance(Class.java:1319)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.os.Looper.loop(Looper.java:137)
05-16 08:53:34.457: E/AndroidRuntime(3422): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): at java.lang.reflect.Method.invoke(Method.java:511)
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-16 08:53:34.457: E/AndroidRuntime(3422): at dalvik.system.NativeStart.main(Native Method)
05-16 08:53:34.457: E/AndroidRuntime(3422): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
05-16 08:53:34.457: E/AndroidRuntime(3422): at com.apptree.de_luxe.InfoActivity.<clinit>(InfoActivity.java:35)
05-16 08:53:34.457: E/AndroidRuntime(3422): ... 15 more
In Eclipse go to:
"Project" -> "Properties" -> "Java Build Properties"
On the "Order and Export" tab I checked "Android Private Libraries" on my project. I also did this for the library project it references. This fixed my class not found errors following upgrading to SDK 22.
You should refer the google play services library project in your map project.
Import your library project to your worksace. import the same to eclipse.
Right click on your project. goto properties. Choose android. click android. browse and add the library project.

java.lang.VerifyError when running Android jUnit Test

I've been trying to work out why I keep getting a java.lang.VerifyError
every time I try to instantiate one of my classes in any of my jUnit tests, but am completely stumped.
I created a simple, minimal test case that exhibits this behaviour:
package com.example;
public class Foo {
private int bar;
public Foo(int b) {
bar = b;
}
public int getBar() {
return bar;
}
}
And the unit tests:
package com.example.tests;
import com.example.Foo;
import junit.framework.TestCase;
public class FooTest extends TestCase {
private Foo foo;
protected void setUp() throws Exception {
super.setUp();
}
public void testSanity() {
foo = new Foo(1);
assertTrue(true);
}
}
When the unit tests attempts to instantiate a Foo object e.g. the first line of the testSanity method, I get a java.lang.VerifyError.
The project is being built against Android 1.6. The stack trace from DDMS in Eclipse looks like this:
05-16 23:40:01.543: ERROR/AndroidRuntime(934): Uncaught handler: thread main exiting due to uncaught exception
05-16 23:40:01.563: ERROR/AndroidRuntime(934): java.lang.VerifyError: com.example.tests.FooTest
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at java.lang.Class.getDeclaredConstructors(Native Method)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at java.lang.Class.getConstructor(Class.java:484)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at junit.framework.TestSuite.getTestConstructor(TestSuite.java:177)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at junit.framework.TestSuite.<init>(TestSuite.java:59)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:103)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.AndroidTestRunner.getTest(AndroidTestRunner.java:124)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:52)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:81)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:375)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:357)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:325)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3848)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.app.ActivityThread.access$2800(ActivityThread.java:116)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.os.Looper.loop(Looper.java:123)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at android.app.ActivityThread.main(ActivityThread.java:4203)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
05-16 23:40:01.563: ERROR/AndroidRuntime(934): at dalvik.system.NativeStart.main(Native Met
Any help in fixing this and getting the tests running would be much appreciated.
UPDATE
Further to fadden's answer, the VFY logcat output is as follows:
05-18 20:33:04.052: ERROR/dalvikvm(234): Could not find class 'com.example.Foo', referenced from method com.example.tests.FooTest.testSanity
05-18 20:33:04.052: WARN/dalvikvm(234): VFY: unable to resolve new-instance 5 (Lcom/example/Foo;) in Lcom/example/tests/FooTest;
05-18 20:33:04.052: WARN/dalvikvm(234): VFY: rejecting opcode 0x22 at 0x0001
05-18 20:33:04.052: WARN/dalvikvm(234): VFY: rejected Lcom/example/tests/FooTest;.testSanity ()V
05-18 20:33:04.052: WARN/dalvikvm(234): Verifier rejected class Lcom/example/tests/FooTest;
The verifier in 1.5/1.6 was pretty severe. The detailed explanation of the problem is on the lines above the exception (look for "VFY" in the logcat output).
UPDATE: looking at the logcat output, code in com.example.tests.FooTest is not able to find com.example.Foo. In Android >= 2.0 this would result in a ClassNotFoundException, but in 1.6 the verifier gets cranky and just rejects the whole class.
So the question is: why can't it find it? The first thing I'd check is to make sure both com.example.Foo and com.example.tests.FooTest appear in the same APK / classes.dex file. You can check this by examining them with "dexdump".

Google Maps Api android key

I have some trouble testing my Android application which includes the google maps API. The ooficial API example worked just fine but if I copy the code into my own project it keeps saying: "The application has stopped unexpectedly". I looked up the key in the keystore several times and registered it with google. Even tried reinstalling the SDK. Does anybody know what the problem is?
Thanks in advance
05-16 14:31:11.142: ERROR/ActivityThread(662): Failed to find provider info for com.google.settings
05-16 14:31:11.150: ERROR/ActivityThread(662): Failed to find provider info for com.google.settings
05-16 14:31:12.598: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound
05-16 14:31:12.624: ERROR/MediaPlayer(562): Unable to to create media player
05-16 14:31:05.098: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:06.538: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:06.645: ERROR/ActivityThread(608): Failed to find provider info for android.server.checkin
05-16 14:31:12.803: ERROR/AndroidRuntime(715): ERROR: thread attach failed
05-16 14:31:13.698: ERROR/ActivityThread(723): Failed to find provider info for com.google.settings
05-16 14:31:13.987: ERROR/AndroidRuntime(723): Uncaught handler: thread main exiting due to uncaught exception
Basically my code is:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//connect to server
//get current map scope
//get media within map scope + a bit
//init and show map
setContentView(R.layout.main);
//add zoom controls
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
//add menu
}
Exceptions:
05-16 15:13:05.204: ERROR/AndroidRuntime(726): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.diretto.client.smartphone.android/org.diretto.client.smartphone.android.AnDiretto}: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.os.Looper.loop(Looper.java:123)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread.main(ActivityThread.java:3948)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at dalvik.system.NativeStart.main(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.createView(LayoutInflater.java:512)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.Activity.setContentView(Activity.java:1626)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at org.diretto.client.smartphone.android.AnDiretto.onCreate(AnDiretto.java:39)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): ... 11 more
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: java.lang.reflect.InvocationTargetException
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.google.android.maps.MapView.(MapView.java:237)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at android.view.LayoutInflater.createView(LayoutInflater.java:499)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): ... 21 more
05-16 15:13:05.204: ERROR/AndroidRuntime(726): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:180)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.google.android.maps.MapView.(MapView.java:279)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): at com.google.android.maps.MapView.(MapView.java:254)
05-16 15:13:05.204: ERROR/AndroidRuntime(726): ... 25 more
XML file line 6 would be:
<com.google.android.maps.MapView android:id="#+id/mapview" ...
followed by other lines of XML-parameters
First, do not answer your own question unless you are truly providing an answer. You can edit your question to add new materials, such as your longer stack trace.
Your exception is:
Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
This is because you are only allowed to have a single MapView in a MapActivity, and apparently you have two or more.
I know you are well past this issue, but I had the same issue, here are my notes about the same problem and how I was able to fix it.
You are only allowed to have a single MapView in a MapActivity
Delete a view and recreate it

Categories

Resources