Orz*_*ech 7 ant android build.xml gradle
我有一个Android项目,它依赖于三个android库.它的project.properties文件如下所示:
split.density=false
android.library.reference.2=..\\LibB
proguard.config=proguard.cfg
android.library.reference.1=..\\\\LibA\\\\
# Project target.
target=android-5
android.library.reference.3=../LibC
Run Code Online (Sandbox Code Playgroud)
此项目的build.xml仅用于依赖Gradle任务:
<target name="-pre-build" depends="preBuild" />
<target name="-pre-compile" depends="preCompile" />
<import file="${sdk.dir}/tools/ant/build.xml" />
Run Code Online (Sandbox Code Playgroud)
和build.gradle以下列方式包含项目的build.xml:
ant.property(file: 'local.properties')
configurations {
sdkDir = ant.properties['sdk.dir']
}
ant.importBuild "build.xml"
Run Code Online (Sandbox Code Playgroud)
当我使用"release"目标运行此脚本时,我从Android的build.xml文件中收到以下错误:
[ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':-build-setup'.
[ERROR] [org.gradle.BuildExceptionReporter] Cause: The following error occurred while executing this line:
[ERROR] [org.gradle.BuildExceptionReporter] Target "${build.target}" does not exist in the project "LibA".
Run Code Online (Sandbox Code Playgroud)
这是由第466行(包含"subant"的行)引起的:
<!-- compile the libraries if any -->
<if>
<condition>
<isreference refid="project.libraries" />
</condition>
<then>
<echo>Building Libraries</echo>
<subant
buildpathref="project.libraries"
antfile="build.xml"
target="${build.target}"
failonerror="true"/>
<echo></echo>
<echo>############################################</echo>
<echo>**** Back to project ${ant.project.name} ****</echo>
<echo>############################################</echo>
</then>
</if>
Run Code Online (Sandbox Code Playgroud)
所以,问题是:是否有人知道如何摆脱该错误或如何在Gradle中正确使用Android的build.xml?
Gradle-android-plugin目前因为android sdk> = r14而被打破,因此我根据它已经辞职了.我使用sdk工具r15.
更新:
似乎两者都没有
<target name="-set-release-mode" depends="-set-mode-check">
Run Code Online (Sandbox Code Playgroud)
也不
<target name="-set-debug-mode">
Run Code Online (Sandbox Code Playgroud)
正在Android的build.xml文件中调用,但我不知道为什么.
我对此环境的具体情况一无所知,但错误消息意味着预期的属性 - build.target
- 未定义。
我注意到您的项目属性文件中有以下内容:
# Project target.
target=android-5
Run Code Online (Sandbox Code Playgroud)
如果改成这样还能用吗?
# Project target.
build.target=android-5
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8290 次 |
最近记录: |