Android Studio - Library reference ../google-play-

2020-05-19 05:40发布

问题:

I am trying to import from Eclipse to AndroidStudio a project of mine and I am getting the following error

First I do not understand why it does not replace the google play services lib for the corresponding entry in the gradle file.

What should I do in order to fix the situation? Any guidance or link to a tutorial would be helpful.

回答1:

Well, there might be another way of solving this problem, but I ended up removing the line in the project.properties file that was making reference to the google-play-services_lib library.



回答2:

An alternative is to simply set the path. You'll need to have installed play services via the Android SDK to use it with Android studio anyway.

Once play services are installed, if you highlight the Google play services entry in the Android SDK manager it will show you the path to the install location. On MAC this is normally something like /Users/[homedir]/android-sdks/extras/google/google_play_services/libproject

Edit the path in project.properties to point to this file and it will import. You can then update your gradle build file as necessary.



回答3:

The simplest solutions is remove this line of code , android.library.reference.2=../google-play-services_lib,from project file (you will find it in project's root folder ) rest android studio will handle itself

Find the file:



回答4:

I think "removing the line in the project.properties file that was making reference to the google-play-services_lib library" is not a good fix. To really fix it do either of these : Just edit the location of the path to google-play-services_lib in project.properties file in your Eclipse project root directory.

android.library.reference.1=path/to/the/google-play-services_lib

Note:If you are on windows path\comes\like\this you have to replace the backward slash with the forward slash and your path/will/become/like/this.

e.g :

C:/Users/username/AppData/Local/Android/sdk/extras/google/google_play_services/libproject/google-play-services_lib

or replace "\" with "\" like below :

android.library.reference.1=C:\\Users\\username\\AppData\\Local\\Android\\sdk\\extras\\google\\google_play_services\\libproject\\google-play-services_lib

otherway is - just look at the last portion of the last line of the error ....which resolves to ...folder_name/google-play-services_lib

just create a folder at that location and paste google-play-services_lib from your google_play_services\libproject\google-play-services_lib



回答5:

I just changed it works for me

android.library.reference.2../google-play-services_lib which changed to

as

android.library.reference.google-play-services_lib



回答6:

The easiest and simple solution is to copy google-play-services_lib folder from another project or SDK folder and past it to the location which is address in the error. By removing or commenting line in the project.properties will create errors in the project and won't allow you to build unless you take necessary steps and fix.