Android The import com.google cannot be resolved

前端 未结 14 1445
猫巷女王i
猫巷女王i 2020-12-09 04:41

I\'m trying to test LocationService example of Android developer as per following link http://developer.android.com/training/location/retrieve-current.html. At that time, er

相关标签:
14条回答
  • 2020-12-09 05:05

    If you are using Android studio you may be missing to add gradle to your project.

    Add specific play service you want. Here you may want to compile

    com.google.android.gms:play-services-location:10.2.1
    

    Add this to your build.gradle app module in dependencies.

    0 讨论(0)
  • 2020-12-09 05:06

    In project.properties I had to add the following (for ANT build):

    android.library.reference.1=${root_prefix}/${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib
    
    0 讨论(0)
  • 2020-12-09 05:13

    Maybe useful for some other developers facing this error: If you are changing to a newer Android Version and if you are using the android-support-library, you have to beware that all projects that you use as library also have the SAME version of the android-support-library. One example would be the actionbar-sherlock. ;)

    0 讨论(0)
  • 2020-12-09 05:15

    You can use this way. First of all close projects which are using google-play-services library. Whenever your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the "Fix project setup" option as below. Then it'll prompt to import the google-play-services library.

    enter image description here

    0 讨论(0)
  • 2020-12-09 05:17

    In android studio,add dependency as follows:

    In gradle script,go in build.gradle(Module:app) and add these lines

    compile 'com.google.android.gms:play-services:10.0.1' in dependencies tag
    

    Here 10.0.1 may be skipped or changed according to your library installed

    0 讨论(0)
  • 2020-12-09 05:17

    You will need the Google Play Services SDK configured within Eclipse and import google play services as library will dismiss this error .

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