当前位置: 首页 > 面试题库 >

ADT升级后不再加载Google地图视图;明显的身份验证问题?

许嘉珍
2023-03-14
问题内容

我正在使用Google
Maps的可感知位置的Android应用程序。前几天,我已通过ADT升级到23.0.0.1245622。我想我之前是v22.6.2-1085508。

现在,地图视图仅包含Google徽标和+/-按钮。而且,奇怪的是,我的logcat包含以下行:

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 reset
–hard恢复到我的代码的先前版本。仍然没有骰子。也许最重要的是,我尝试在控制台中创建一个新的API密钥,并将其粘贴到清单中。(顺便说一句,尝试进行此实验后,我恢复了原来的密钥,如果那真的很重要的话。)

我将在下面发布完整的日志:

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密钥被删除:

<?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>

哦,这也是我的地图创建代码:

  @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位JDK。我怀疑这是否真的有用,但是我只是想掩盖基础。


问题答案:

在查看user2103379的答案并检查我的API密钥时,我发现软件包名称和API密钥正确。但是,我的新调试密钥的SHA-1未添加到接受的客户端列表中。糟糕!无论如何,我将新的SHA-1放入其中,清理了Eclipse项目(在禁用自动清理后的构建之后)并重新构建了该项目。很好



 类似资料:
  • 我有一个相当大的Android应用程序项目,它引用了几个库项目。在我将eclipse ADT插件升级到最新版本(v22)之前,一切都很好。当然我也升级了SDK。我在eclipse中没有看到任何编译错误,但是当我在电话上运行项目时,我得到一个NoClassDefoundError。 arca库包含在一个引用库项目中(在libs文件夹中),我可以在package explorer中的“Android

  • 在本章中,我们将向您展示如何在Firebase中设置Google身份验证。 第1步 - 启用Google身份验证 打开Firebase仪表板,然后单击左侧菜单上的“ Auth ”。 要打开可用方法列表,您需要单击选项卡菜单中的SIGN_IN_METHODS 。 现在,您可以从列表中选择Google ,启用它并保存。 第2步 - 创建按钮 在我们的index.html ,我们将添加两个按钮。 的in

  • 在我的Laravel应用程序中,我有不同的管理员和用户身份验证。所以我也有单独的观点。我已经把auth文件夹放在文件夹中,这样我的admin auth的视图路径现在是。在哪里可以更改这些路径,以便可以将它们用于所有身份验证函数?

  • 升级自:JBoss EAP 6.4/Spring Security 4.2.1(XML配置) 升级至:Spring Boot 2.2.4/Spring Security 5.2.1(JavaConfig) 我们有一个受Spring Security保护的RESTendpoint,它使用X509身份验证和一个测试客户端。 我在Spring Security的过滤器链中的: 在进入Spring Boo

  • 我正在开发一个小部件,以显示一些数据从我的网站给别人。为此,我必须通过javascript createElement方法动态加载一些脚本文件。这是我的代码。 }; var map=new google.maps.map(document.getElementById(“map_canvas”),mapOptions); 这段代码在script.onload函数和document.ready函数中

  • 我们使用kerberos身份验证来执行SSO。早些时候,我们的产品在JRE 6 Update 22上运行,一切正常。我们最近迁移到JRE 6 update 45,kerberos身份验证失败。 因此,代码基本上执行两个步骤——连接和登录1。“连接”步骤测试SPN名称和凭据(密码或密钥表)是否可以登录到由领域和KDC信息标识的域控制器。2.“登录”步骤执行相同的操作,然后还尝试使用GSSAPI身份验