当前位置: 首页 > 知识库问答 >
问题:

Google Maps在Android上运行良好,但我仍然得到一个错误“无法找到类'Maps.I.k',引用自方法Maps.z.ag.a”。

冯旭
2023-03-14

我让Google Maps Android API v2在我的Android应用程序上完美地工作,方法是下载库,将其添加到工作区,然后将其作为库引用。

但当包含映射片段的活动启动时,我仍然会收到此错误

Could not find class 'maps.i.k', referenced from method maps.z.ag.a

顺便说一下,我使用的是支持映射片段

这个错误似乎不会影响我在反正也不会崩溃应用程序或任何东西,我应该麻烦修复它吗?

添加了清单p.s E_SelectJourney是我显示和使用地图的地方

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.HelloMap.AndroidApp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <permission
        android:name="com.HelloMap.AndroidApp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.HelloMap.AndroidApp.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <application
        android:allowBackup="true"
        android:configChanges="orientation"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Sherlock" >
        <uses-library
            android:name="com.google.android.maps"
            android:required="true" />

        <activity
            android:name="com.HelloMap.AndroidApp.A_SplashScreen"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.B_TourSlides"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.C_RegisterLogin"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity android:name="com.facebook.LoginActivity" />
        <activity
            android:name="com.HelloMap.AndroidApp.D_RegistrationPage"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.E_SelectJourney"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.F_EnterFromToAddress"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.G_PickDateTime"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.H_ConfirmContact"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.I_MobileVerification"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.J_AvailableTaxis"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.K_SpecialRequirements"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.L_JourneyOverview"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.M_PaymentOptions"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.HelloMap.AndroidApp.N_Confirmation"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyBoWsWNaUTWyHxGuJuNehzfbNvyTv1zIeA" />
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="141236504136755" />
    </application>

</manifest>

添加了logcat

03-26 16:57:14.897: W/dalvikvm(27771): Unable to resolve superclass of Lmaps/p/s; (427)
03-26 16:57:14.897: W/dalvikvm(27771): Link of class 'Lmaps/p/s;' failed
03-26 16:57:14.897: W/dalvikvm(27771): Unable to resolve superclass of Lmaps/y/bo; (3820)
03-26 16:57:14.897: W/dalvikvm(27771): Link of class 'Lmaps/y/bo;' failed
03-26 16:57:14.897: W/dalvikvm(27771): Unable to resolve superclass of Lmaps/i/k; (4208)
03-26 16:57:14.897: W/dalvikvm(27771): Link of class 'Lmaps/i/k;' failed
03-26 16:57:14.897: E/dalvikvm(27771): Could not find class 'maps.i.k', referenced from method maps.z.ag.a
03-26 16:57:14.897: W/dalvikvm(27771): VFY: unable to resolve new-instance 3540 (Lmaps/i/k;) in Lmaps/z/ag;
03-26 16:57:15.567: W/SchedPolicy(27771): add_tid_to_cgroup failed to write '' (Invalid argument); background=0

共有1个答案

华昕
2023-03-14

删除此代码:

 <uses-library
        android:name="com.google.android.maps"
        android:required="true" />

首先,Google Map API V2不需要它。

接下来,尝试将此代码移动到关闭的application标记之前:

 <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyBoWsWNaUTWyHxGuJuNehzfbNvyTv1zIeA" />

像这样:

 <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyBoWsWNaUTWyHxGuJuNehzfbNvyTv1zIeA" />
</application>

最后检查您是否在Google API控制台中打开了Right API服务:

您可以从我写的这两篇博文中获得关于这两个主题的更多信息:

Google Maps API V2

和:

Google Maps API V2密钥

要获得许可,请检查此链接:

http://android-er.blogspot.co.il/2012/12/include-open-source-software-license.html

基本上,在应用程序的某个位置,无论是活动还是对话框,您都必须运行以下操作:

String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());

并以某种形式呈现结果。

 类似资料: