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”

前端 未结 6 1262
Happy的楠姐
Happy的楠姐 2020-12-10 12:14

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.

Bu

相关标签:
6条回答
  • 2020-12-10 12:57
    <uses-library android:name="com.google.android.maps" />
    

    add this library in your manifest file.

    0 讨论(0)
  • 2020-12-10 13:00

    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:

    enter image description here

    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.

    0 讨论(0)
  • 2020-12-10 13:10

    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

    0 讨论(0)
  • 2020-12-10 13:10

    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.

    0 讨论(0)
  • 2020-12-10 13:11

    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.

    0 讨论(0)
  • 2020-12-10 13:13

    Try this guide. Creating your Google Map Application

    0 讨论(0)
提交回复
热议问题