eclipse Android Studio - 无法找到库参考 ../google-play-services_lib 导入项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26443718/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio - Library reference ../google-play-services_lib could not be found importing project
提问by AlvaroSantisteban
I am trying to import from Eclipse to AndroidStudio a project of mine and I am getting the following error
我正在尝试将我的一个项目从 Eclipse 导入到 AndroidStudio,但出现以下错误
First I do not understand why it does not replace the google play services lib for the corresponding entry in the gradle file.
首先,我不明白为什么它不替换 gradle 文件中相应条目的 google play services lib。
What should I do in order to fix the situation? Any guidance or link to a tutorial would be helpful.
我应该怎么做才能解决这个问题?任何指导或教程链接都会有所帮助。
回答by AlvaroSantisteban
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.
好吧,可能有另一种方法可以解决这个问题,但我最终删除了project.properties
文件中引用google-play-services_lib
库的行。
回答by Adeeb karim
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
最简单的解决方案是从项目文件中删除这行代码,android.library.reference.2=../google-play-services_lib(你会在项目的根文件夹中找到它),剩下的 android studio 将自行处理
回答by mark
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.
另一种方法是简单地设置路径。无论如何,您都需要通过 Android SDK 安装播放服务才能在 Android Studio 中使用它。
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
安装播放服务后,如果您在 Android SDK 管理器中突出显示 Google 播放服务条目,它将显示安装位置的路径。在 MAC 上,这通常类似于 /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.
编辑 project.properties 中的路径以指向此文件,它将导入。然后,您可以根据需要更新 gradle 构建文件。
回答by Raulp
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.
我认为“删除 project.properties 文件中引用 google-play-services_lib 库的行”不是一个好的解决方法。要真正修复它,请执行以下任一操作:只需在 Eclipse 项目根目录中的 project.properties 文件中编辑 google-play-services_lib 路径的位置。
android.library.reference.1=path/to/the/google-play-services_lib
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
另一种方式是 - 只需查看错误最后一行的最后一部分......它解析为 ...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
只需在该位置创建一个文件夹并从您的位置粘贴 google-play-services_lib google_play_services\libproject\google-play-services_lib
回答by Prathap Reddy
I just changed it works for me
我只是改变了它对我有用
android.library.reference.2../google-play-services_lib which changed to
android.library.reference.2../google-play-services_lib 更改为
as
作为
android.library.reference.google-play-services_lib
android.library.reference.google-play-services_lib
回答by Maihan Nijat
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.
最简单的解决方案是google-play-services_lib
从另一个项目或 SDK 文件夹中复制文件夹并将其粘贴到错误中的地址位置。通过删除或注释中的project.properties
行将在项目中创建错误,除非您采取必要的步骤和修复,否则不允许您进行构建。