简体   繁体   中英

Google Maps works fine on Android but I still get an error “Could not find class 'maps.i.k', referenced from method maps.z.ag.a”

I got Google Maps Android API v2 to work perfectly on my Android Application by downloading the library, adding it to workspace, then referencing it as a library.

But I still get this error as soon as the activity containing the Map Fragment starts

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

By the way I'm using support map fragment

This error does not seem to affect me in anyway nor crash the application nor anything, should I bother fixing it ?

Added the manifest PS E_SelectJourney is where I display and use the map

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

Added the 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

Remove this code:

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

first of all it's not required for Google Map API V2 .

Next, try to move this code to be right before the closing application tag:

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

like that:

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

Finally check that you have turned on the right API service in Google API Console :

在此输入图像描述

You can get more information on both of this topics from this two blog posts I wrote:

Google Maps API V2

and:

Google Maps API V2 key

UPDATE:

For the licensing check this link:

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

basically in some place in your application whether it an activity or a dialog you have to run this:

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

and present the result in some form of fashion.

I'm not sure but another question has the same error included in it's errors and in that case the app was not signed correctly. If this is the problem you will need to fix it before deploying your app professionally as it will only work in debug mode.

https://stackoverflow.com/a/15465572/1873970

You should not worry about those Dalvik warnings. I believe those shows up since the Google Maps library is compiled to an API level that is higher than the one running on your phone. Some classes that are available on the higher API are not available on your phone but the library must have some code to compensate for that already.

I finally do it! If you're using SupportFragmentMap I think you should turn on the google maps android v2 on the api console, because I was using the Google Maps v2 and it worked fine with FragmentMap but when I changed for SupportFragmentMap to include froyo and gingerbread compatibility it didn't run. I spend 4 stressfull hours searching, trying, coding, changing keys, libraries, updating and... I just turned on the Google Android Maps v2 and turned off the Google Maps v2 and now it's working! Thanks a lot.

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

在清单文件中添加此库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM