问题描述
您好女士们,堆栈溢出的先生们,
Hello ladies and gentlemen of Stack Overflow,
我工作的一个位置感知的Android应用程序,使用谷歌地图。我通过ADT升级到23.0.0.1245622的一天。我想我是在v22.6.2-1085508在那之前。
I'm working on an location-aware Android app that uses Google Maps. I upgraded by ADT to 23.0.0.1245622 the other day. I think I was on v22.6.2-1085508 before then.
现在的地图视图只包含谷歌标识和+/-按钮。而且,诡异,我的logcat包含以下行:
Now the map view only contains the Google logo and the +/- buttons. And, eerily, my logcat contains the following line:
07-01 12:15:08.548: E/Google Maps Android API(6299): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
我试图清理项目,顺便说一句。没有骰子。我试图在一个AVD,而不是我的Galaxy S3运行此。没有骰子。我试着使用Git的复位 - 硬恢复到我的code一previous修订。仍然没有骰子。也许最重要的是,我试图创造在控制台中一个新的API密钥,并粘贴到这一点我的清单。 (顺便说一句,我恢复了我的旧密钥尝试这个实验后,如果这是在所有显著。)
I have tried cleaning the project, by the way. No dice. I tried running this on an AVD instead of my Galaxy S3. No dice. I tried reverting to a previous revision of my code using git reset --hard. Still no dice. Perhaps most importantly, I tried creating a new API key in the console, and pasted that into my manifest. (Incidentally, I reverted to my older key after trying this experiment, if that is at all significant.)
我会后下一个完整的logcat:
I will post a full logcat below:
07-01 12:14:51.920: D/ActivityThread(6299): handleBindApplication:com.gregeveritt.hoodies
07-01 12:14:51.920: D/ActivityThread(6299): setTargetHeapUtilization:0.75
07-01 12:14:51.920: D/ActivityThread(6299): setTargetHeapMinFree:524288
07-01 12:14:52.560: I/Google Maps Android API(6299): Google Play services client version: 4132500
07-01 12:14:52.560: I/dalvikvm(6299): Could not find method guj.a, referenced from method gqi.a
07-01 12:14:52.560: W/dalvikvm(6299): VFY: unable to resolve static method 24932: Lguj;.a (Landroid/content/Context;)Lgri;
07-01 12:14:52.560: D/dalvikvm(6299): VFY: replacing opcode 0x71 at 0x0003
07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a
07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps;
07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000
07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a
07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps;
07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000
07-01 12:14:52.570: E/dalvikvm(6299): Could not find class 'gpr', referenced from method gps.a
07-01 12:14:52.570: W/dalvikvm(6299): VFY: unable to resolve new-instance 4089 (Lgpr;) in Lgps;
07-01 12:14:52.570: D/dalvikvm(6299): VFY: replacing opcode 0x22 at 0x0000
07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0a in Lgps;.a
07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0c in Lgps;.a
07-01 12:14:52.570: D/dalvikvm(6299): DexOpt: unable to opt direct call 0x5e9f at 0x0a in Lgps;.a
07-01 12:14:52.601: I/Google Maps Android API(6299): Google Play services package version: 5082036
07-01 12:14:52.611: W/dalvikvm(6299): VFY: unable to resolve static field 20868 (t) in Lyp;
07-01 12:14:52.611: D/dalvikvm(6299): VFY: replacing opcode 0x62 at 0x000e
07-01 12:14:52.611: W/dalvikvm(6299): VFY: unable to resolve static field 20868 (t) in Lyp;
07-01 12:14:52.611: D/dalvikvm(6299): VFY: replacing opcode 0x62 at 0x000d
07-01 12:14:52.931: W/ActivityThread(6299): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
07-01 12:14:52.971: I/dalvikvm(6299): Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4022 'Lgln;'
07-01 12:14:52.971: W/dalvikvm(6299): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
07-01 12:14:52.971: E/dalvikvm(6299): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
07-01 12:14:52.971: W/dalvikvm(6299): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt;
07-01 12:14:52.971: D/dalvikvm(6299): VFY: replacing opcode 0x1f at 0x0019
07-01 12:14:53.111: I/Adreno200-EGL(6299): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.059_msm8960_JB_2.5.5_CL3896081_release_AU (CL3896081)
07-01 12:14:53.111: I/Adreno200-EGL(6299): Build Date: 06/25/13 Tue
07-01 12:14:53.111: I/Adreno200-EGL(6299): Local Branch:
07-01 12:14:53.111: I/Adreno200-EGL(6299): Remote Branch: quic/jb_2.5.5
07-01 12:14:53.111: I/Adreno200-EGL(6299): Local Patches: NONE
07-01 12:14:53.111: I/Adreno200-EGL(6299): Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.059 + NOTHING
07-01 12:14:53.161: D/OpenGLRenderer(6299): Enabling debug mode 0
07-01 12:14:53.311: I/Google Maps Android API(6299): Failed to contact Google servers. Another attempt will be made when connectivity is established.
07-01 12:14:54.022: I/Choreographer(6299): Skipped 51 frames! The application may be doing too much work on its main thread.
07-01 12:14:54.723: I/Google Maps Android API(6299): Google Play services package version: 5082036
07-01 12:14:55.964: I/Choreographer(6299): Skipped 61 frames! The application may be doing too much work on its main thread.
07-01 12:14:56.304: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302027791
07-01 12:14:56.304: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302027791
07-01 12:15:08.548: E/Google Maps Android API(6299): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
07-01 12:15:58.571: W/IInputConnectionWrapper(6299): getExtractedText on inactive InputConnection
07-01 12:15:58.571: W/IInputConnectionWrapper(6299): getTextBeforeCursor on inactive InputConnection
07-01 12:15:58.581: W/IInputConnectionWrapper(6299): getSelectedText on inactive InputConnection
07-01 12:15:58.581: W/IInputConnectionWrapper(6299): getTextAfterCursor on inactive InputConnection
07-01 12:16:04.027: I/Google Maps Android API(6299): Google Play services package version: 5082036
07-01 12:16:04.167: W/IInputConnectionWrapper(6299): getExtractedText on inactive InputConnection
07-01 12:16:04.227: W/IInputConnectionWrapper(6299): getTextBeforeCursor on inactive InputConnection
07-01 12:16:05.468: W/IInputConnectionWrapper(6299): getSelectedText on inactive InputConnection
07-01 12:16:05.498: W/IInputConnectionWrapper(6299): getTextAfterCursor on inactive InputConnection
07-01 12:16:05.518: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302097011
07-01 12:16:51.027: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302142518
07-01 12:17:31.530: I/Google Maps Android API(6299): Google Play services package version: 5082036
07-01 12:17:32.521: I/Choreographer(6299): Skipped 49 frames! The application may be doing too much work on its main thread.
07-01 12:17:33.142: I/Timeline(6299): Timeline: Activity_idle id: android.os.BinderProxy@41bc4ef8 time:302184634
下面是我的表现,我的API密钥涂抹了:
Here is my manifest, with my api key blotted out:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gregeveritt.hoodies"
android:versionCode="1"
android:versionName="0.3" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.gregeveritt.hoodies.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my_api_key" />
</application>
</manifest>
呵呵,这是我的地图制作code,以及:
Oh, and here's my map creation code, as well:
@Override
public void onConnected(Bundle dataBundle) {
Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
try {
showNeighborhood();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO potentially switch to SupportMapFragment, lower MinSDK from 12 to 11
mMap = ( (MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
CameraUpdate startingCamera = CameraUpdateFactory.newLatLng( new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()) );
mMap.moveCamera(startingCamera);
// TODO What if mMap was null-checked?
}
注:某处在这个过程中,我也被关在32位JDK到64位之一。我怀疑这是相关的,但是我只是想掩盖我的基地。
Note: Somewhere in this process, I also switched from a 32-bit JDK to a 64-bit one. I doubt that's relevant at all, but I just like to cover my bases.
推荐答案
虽然找过user2103379的答案,并检查我的API密钥,我发现包名和API密钥是正确的。然而,使用SHA-1为我的新调试键不加入到接受客户端的列表。哎呀!无论如何,我把新的SHA-1在那里,清洗Eclipse项目(禁用自动后干净的构建之后),并建项目重新。工作的罚款。
While looking over user2103379's answer and checking my API key, I found that the package name and the API key were correct. However, the SHA-1 for my new debug key was not added to the list of accepted clients. Oops! Anyway, I put the new SHA-1 in there, cleaned the Eclipse project (after disabling automatic post-clean build) and built the project anew. Worked fine.
这篇关于谷歌地图视图不再加载ADT升级后;显而易见身份验证问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!