How to fix Google Play Services 2 Library install to Eclipse

后端 未结 5 1455
情歌与酒
情歌与酒 2020-12-14 22:23

I\'ve tried to follow https://developer.android.com/google/play-services/setup.html instructions in Eclipse for Mobile Developers (Juno), but am getting multiple errors with

相关标签:
5条回答
  • 2020-12-14 22:56

    I had the same problem. I went to Properties->Java Build Path and clicked on the Projects tab. Then I added google-play-services_lib using the Add button. This got me this run-time exception:

    E/AndroidRuntime(9469): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment

    So then I changed the main.xml file entry from this:

          android:name="com.google.android.gms.maps.MapFragment"
    

    to this:

        android:name="com.google.android.gms.maps.SupportMapFragment"
    

    And FINALLY, it runs, but NOW no map due to authorization failure. So I am off on another search.

    thanks Google for making it so complicated and for posting incorrect instructions!

    0 讨论(0)
  • 2020-12-14 22:57

    Try the following :

    https://developers.google.com/maps/documentation/android/intro#sample_code
    

    You would get errors while opening an activity mentioned in the sample code. That is because android.support.v4.app.FragmentActivity is not added to your build path. Hover over the error and click on "Fix Project Setup". It would ask you to add the lib to the build path. Say Yes and enjoy :)

    0 讨论(0)
  • 2020-12-14 22:59

    If your google_pay_services/libproject is empty (mine was empty) and looks like installed in sdk manager, first delete google play services from sdk manager, install it again and follow the steps in the first answer.

    0 讨论(0)
  • 2020-12-14 23:12

    There is a misleading step in step 3 of http://developer.android.com/google/play-services/setup.html:

    Copy the /extras/google/google_play_services/libproject/google-play-services_lib library project into the source tree where you maintain your Android app projects.

    If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.

    Don't do the first copy. Instead just do the second part and check the box that says "Copy projects into workspace". I found that if I did the first part I would end up with empty xml files.

    0 讨论(0)
  • 2020-12-14 23:13

    Try Window > Android SDK Manager > Extras > Google play service > Delete package.

    And then re-install that package again:

    File > Import, select Android > Existing Android Code into Workspace

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