Ant debug and ant release failed

前端 未结 4 581
既然无缘
既然无缘 2021-01-05 19:16

I am trying to generate apk on command line using ant. I am able to use ant clean but for ant debug and ant release command I am getting following error.

相关标签:
4条回答
  • 2021-01-05 19:58

    This bit Cannot run program "C:\Workspace\SampleApp\${aapt}"suggests that the variable ${aapt} has not been translated by the compiler.

    Check that ${aapt} has been defined earlier in your build script. Try printing out value of ${aapt} (e.g. <echo>aapt variable: ${aapt}</echo>) immediately before the line that triggers the error, to check that the build has correctly compiled the variable.

    0 讨论(0)
  • 2021-01-05 19:58

    make sure the proguard.config point to an existing proguard file in your project.properties

    proguard.config=proguard-project.txt
    
    0 讨论(0)
  • 2021-01-05 20:14

    I had the same error after updating the android SDK to the latest build tools.

    The tools\ant\build.xml script does not contain any references for the tools.

    This can be solved, by adding the tools to the build.xml and point to the correct path. For me this was build-tools\22.0.1

    Please compare and update the tool section in build.xml

    <!-- tools location -->
    <property name="android.tools.dir" location="${sdk.dir}/tools" />
    <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
    <property name="android.buildtools.dir" location="${sdk.dir}/build-tools/22.0.1" />
    <condition property="exe" value=".exe" else=""><os family="windows" /></condition>
    <condition property="bat" value=".bat" else=""><os family="windows" /></condition>
    <property name="adb" location="${android.platform.tools.dir}/adb${exe}" />
    <property name="lint" location="${android.tools.dir}/lint${bat}" />
    <property name="zipalign" location="${android.buildtools.dir}/zipalign${exe}" />
    <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" />
    <property name="aapt" location="${android.buildtools.dir}/aapt${exe}" />
    <property name="dx" location="${android.buildtools.dir}/dx${bat}" />
    <property name="renderscript" location="${android.buildtools.dir}/llvm-rs-cc${exe}"/>
    <property name="lint" location="${android.tools.dir}/lint${bat}" />
    

    Thank you Alex for the tip!

    0 讨论(0)
  • 2021-01-05 20:15

    Just update android sdk tool to 24.3.3

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