eclipse android can not import google play services library

前端 未结 5 747
攒了一身酷
攒了一身酷 2021-01-29 07:07

hello i am quite new to Android development and i want to learn how to use the google Maps API v2. After trying numerous tutorials, i always seem to have a problem with the goog

相关标签:
5条回答
  • 2021-01-29 07:17

    if your giving google-Play-Service-lib as a references to your project , try to keep your project and the Google-play services lib should be in same drive.

    if your project is on C: drive means place Google-play-services-lib in C:

    0 讨论(0)
  • 2021-01-29 07:25

    The important thing in adding a library in eclipse is to remember that your project and the library project need to be in the same workspace.

    To solve this follow below ways,

    You can copy the google-play-services library project to the same workspace where your main project is there.

    else

    While importing the library to eclipse remember to check copy projects into workspace which will add a copy of the library to your workspace.

    enter image description here

    0 讨论(0)
  • 2021-01-29 07:26

    I see a red "X" and a question mark under "project" instead of the green tick.

    The problem is -

    The path to your google play services library is not same as the path to your project. It is outside of your project. And so is not recognized by simple import.

    Solution - Put the library in the project's libs folder.

    NOTE: Just putting the library to the libs folder is not enough.

    After you added your library follow these steps -

    1) Go to Project -> Properties -> Java Build Path -> Libraries -> Add JARs..

    2) Now add your recently added jar to the build path from JAR selection process.

    3) Go to Project -> Properties -> Java Build Path -> Order and Export.

    4) Put a tick mark in the check box against this library name and press OK.

    5) Do Project -> Clean.

    0 讨论(0)
  • 2021-01-29 07:28

    While making the copy of the entire folder libproject containing google-play-services_lib from eclipse import project by selecting the copied libproject folder in your working place.

    For the rest follow the steps in Setting Up Google Play Services

    0 讨论(0)
  • 2021-01-29 07:29

    Eclipse

    • Copy the library project at

    <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/

    to the location where you maintain your Android app projects.

    • Import the library project into your Eclipse workspace. Click

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

    and browse to the copy of the library project to import it.

    • After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:
    < meta-data android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
    

    Android Studio

    • Open the build.gradle file inside your application module directory.
    • Add a new build rule under dependencies for the latest version of play-services eg
        ...
        dependencies {
            compile 'com.google.android.gms:play-services:9.2.0'
        }
    apply plugin: 'com.android.application'
    

    Source developers.google.com

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