Java Android:ANT 构建失败并显示 google-play-services-lib:“解析为没有项目的 project.properties 文件的路径”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21265111/
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: ANT build fails with google-play-services-lib: "resolve to a path with no project.properties file for project"
提问by mitai
I'm trying to build my apps using ANT and I'm failing miserably after I included the google-play-services-lib library project.
我正在尝试使用 ANT 构建我的应用程序,但在我包含 google-play-services-lib 库项目后我失败了。
Step 1
第1步
I set up a reference to the library project in my project.properties file:
我在 project.properties 文件中设置了对库项目的引用:
android.library.reference.1=/path/to/google-play-services_lib
Step 2
第2步
I ran these commands inside the google-play-services_lib folder:
我在 google-play-services_lib 文件夹中运行了这些命令:
android update lib-project --path .
ant clean
ant release
BUILD SUCCESS!
建立成功!
Step 3
第 3 步
Back to my project folder
回到我的项目文件夹
ant clean
ant release
ERROR
错误
BUILD FAILED
/android/tools/ant/build.xml:460: /path/to/google-play-services_lib resolve to a path with no project.properties file for project /my/project-folder
There IS a project.properties in both folders, naturally. The one in google-play-services_lib contains this code:
自然,两个文件夹中都有一个 project.properties 。google-play-services_lib 中的一个包含以下代码:
target=android-8
android.library=true
I'm obviously missing something that's right there in front of me and I'd really appreciate your help. Thanks!
我显然错过了一些就在我面前的东西,我真的很感激你的帮助。谢谢!
采纳答案by Kevin
Try changing the android library reference to a relative path (relative to the current directory) instead of an absolute path.
尝试将 android 库引用更改为相对路径(相对于当前目录)而不是绝对路径。
e.g.
例如
android.library.reference.1=../../../relative_path/to/google-play-services_lib
回答by Jerome Anthony
I had the same issue when developing a cordova project. I copied the google-play-services-lib project folder to the same directory as the project directory and set the reference as
我在开发科尔多瓦项目时遇到了同样的问题。我将 google-play-services-lib 项目文件夹复制到与项目目录相同的目录,并将引用设置为
android.library.reference.2=google-play-services_lib
In my case I had reference to the cordova project as well, hence android.library.reference.2
就我而言,我也参考了cordova项目,因此是android.library.reference.2