问题
I don't know why this error is occuring. I didn't update anything. I generated new keys from the google api console but the error is stil appearing. I wanted to do this example [Android SearchView widget with Google Places API][1].
debug->res->values->google_maps_api.xml
I also have a release folder with the same structure and I entered the same key in both files.
Log:
3151-3151/com.example.onur I/Google Maps Android API﹕ Google Play services client version: 4242000
07-18 10:28:13.655 3151-3151/com.example.onur I/dalvikvm﹕ Could not find method guj.a, referenced from method gqi.a
07-18 10:28:13.655 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve static method 24936: Lguj;.a (Landroid/content/Context;)Lgri;
07-18 10:28:13.655 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0003
07-18 10:28:13.665 3151-3151/com.example.onur E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-18 10:28:13.665 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-18 10:28:13.665 3151-3151/com.example.onur E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-18 10:28:13.665 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-18 10:28:13.665 3151-3151/com.example.onur E/dalvikvm﹕ Could not find class 'gpr', referenced from method gps.a
07-18 10:28:13.665 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0c in Lgps;.a
07-18 10:28:13.665 3151-3151/com.example.onur D/dalvikvm﹕ DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-18 10:28:13.685 3151-3151/com.example.onur I/Google Maps Android API﹕ Google Play services package version: 5084036
07-18 10:28:13.695 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve static field 20873 (t) in Lyp;
07-18 10:28:13.695 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x000e
07-18 10:28:13.700 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve static field 20873 (t) in Lyp;
07-18 10:28:13.700 3151-3151/com.example.onur D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x000d
07-18 10:28:13.890 3151-3151/com.example.onur D/dalvikvm﹕ GC_FOR_ALLOC freed 502K, 15% free 9978K/11648K, paused 29ms, total 29ms
07-18 10:28:14.065 3151-3454/com.example.onur D/dalvikvm﹕ GC_FOR_ALLOC freed 313K, 14% free 10119K/11660K, paused 17ms, total 17ms
07-18 10:28:14.155 3151-3151/com.example.onur I/dalvikvm﹕ Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lgln;'
07-18 10:28:14.155 3151-3151/com.example.onur W/dalvikvm﹕ Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
07-18 10:28:14.155 3151-3151/com.example.onur E/dalvikvm﹕ Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
07-18 10:28:14.155 3151-3151/com.example.onur W/dalvikvm﹕ VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt;
[1]: http://wptrafficanalyzer.in/blog/android-searchview-widget-with-google-places-api-using-actionbarsherlock-library/
[2]: http://i.stack.imgur.com/R8fGG.jpg
回答1:
I've got a few solutions:
- first have you tried regenerating your API key?
- When you go into the google console, what does it say your package name is? Make sure its the correct package that your map activity is in.
- After doing both of those, make sure to either clear data or uninstall the app you're working with - settings -> apps -> my_app -> and either clear data or uninstall
Does that work? Let me know.
回答2:
the problem is with thw Api key or the package name... you just go through it...
probably the error can be in the manifest file or on the google console...
回答3:
Could you post your manifest? Sans API key, of course.
Your log looks almost identical to mine for a problem I've had recently, which was fixed by adding the following to the manifest:
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
I'm working on an application that was accessing maps just fine, then stopped out of the blue. I couldn't see anything actually pointing to a missing permission; I only picked up on it when I compared the manifest with another application that used maps api v2.
I'm still confused as to why it previously worked without it (Google says you need the permission for maps to work). Perhaps I'd once put it there and accidentally deleted the line, but either way putting it in is what fixed it.
Source: https://developers.google.com/maps/documentation/business/mobile/android/config
来源:https://stackoverflow.com/questions/24821249/could-not-find-class-gpr-referenced-from-method-gps-a