Ant debugging and Ant release error

I am trying to generate apk on the command line using ant. I can use ant clean, but for ant debug and ant release command. I get the following error.

STRICTLY MALFUNCTIONAL

C: \ Android \ sdk \ tools \ ant \ build.xml: 649: The following error occurred while executing this line: C: \ Android \ sdk \ tools \ ant \ build.xml: 694: Failed to execute: java.io. IOException: it is impossible to run the program "C: \ Workspace \ SampleApp \ $ {aapt}": CreateProcess error = 2, Th e system cannot find the specified file in java.lang.ProcessBuilder.start (ProcessBuilder.java:1047) in java. lang.Runtime.exec (Runtime.java:617) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec (Jav a13CommandLauncher.java:58) ...

In the line, the line build.xml: 694 proguardFile="${out.absolute.dir}/proguard.txt"> present. I am using Eclipse Juno and the build target is 22 (Lollipop). Any help is appreciated.

+5
source share
4 answers

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

Tools \ ant \ build.xml script do not contain links to tools.

This can be solved by adding tools to the build.xml file and pointing to the correct path. For me, these were tools for building \ 22.0.1

Please compare and update the tool section in the build.xml file

 <!-- 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}" /> 

Thanks Alex for the tip!

+9
source

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

Make sure ${aapt} was defined earlier in your build script. Try printing the value of ${aapt} (for example, <echo>aapt variable: ${aapt}</echo> ) immediately before the line that causes the error to check if this assembly is compiled correctly.

+2
source

Just update the sdk tool for Android to 24.3.3

+2
source

make sure proguard.config points to an existing proguard file in project.properties

 proguard.config=proguard-project.txt 
0
source

All Articles