zhanwei / android-apktool

Automatically exported from code.google.com/p/android-apktool
Other
0 stars 1 forks source link

Compilation not working if apktool is not on the parent folder of the src folder. #641

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Follow this configuration :

-Working Folder
---bin
---original
---result

Put apktool in bin folder, put apk file in original folder
Execute extract from original/my.apk to a new folder called ./tmp
=> ./bin/apktool d ./original/my.apk ./tmp

Now, this is your configuration :
-Working Folder
---bin
---original
---result
---tmp

2. Execute ./bin/apktool b ./tmp 

3. Here we are :

I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec 
command: [aapt, p, --min-sdk-version, 4, --target-sdk-version, 11, -F, 
/var/folders/qx/47_32xcj3db0kgjbd43142g40000gn/T/APKTOOL7982179771025126033.tmp,
 -0, arsc, -I, /Users/Dev/Library/apktool/framework/1.apk, -S, 
/Users/Dev/Workspace/apktool/./tmp/res, -M, 
/Users/Dev/Workspace/apktool/./tmp/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
    at brut.androlib.Androlib.buildResources(Androlib.java:283)
    at brut.androlib.Androlib.build(Androlib.java:206)
    at brut.androlib.Androlib.build(Androlib.java:176)
    at brut.apktool.Main.cmdBuild(Main.java:228)
    at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could 
not exec command: [aapt, p, --min-sdk-version, 4, --target-sdk-version, 11, -F, 
/var/folders/qx/47_32xcj3db0kgjbd43142g40000gn/T/APKTOOL7982179771025126033.tmp,
 -0, arsc, -I, /Users/Dev/Library/apktool/framework/1.apk, -S, 
/Users/Dev/Workspace/apktool/./tmp/res, -M, 
/Users/Dev/Workspace/apktool/./tmp/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:357)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
    ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, 
--min-sdk-version, 4, --target-sdk-version, 11, -F, 
/var/folders/qx/47_32xcj3db0kgjbd43142g40000gn/T/APKTOOL7982179771025126033.tmp,
 -0, arsc, -I, /Users/Dev/Library/apktool/framework/1.apk, -S, 
/Users/Dev/Workspace/apktool/./tmp/res, -M, 
/Users/Dev/Workspace/apktool/./tmp/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:93)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:355)
    ... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": error=2, No such 
file or directory
    at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:466)
    at brut.util.OS.exec(OS.java:84)
    ... 7 more
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
    at java.lang.ProcessImpl.start(ProcessImpl.java:91)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 10 more

What version of the product are you using? On what operating system?

version : 1.5.2 on Mac Os X 10.9.3

Please provide any additional information below.

Seems that it try to reach /Users/Dev/Workspace/apktool/./tmp/res instead of 
the real path : /Users/Dev/Workspace/apktool/../tmp/res 

No problem when apktool is on Working folder.

Original issue reported on code.google.com by Dahe...@gmail.com on 31 May 2014 at 6:09

GoogleCodeExporter commented 9 years ago
aapt isn't globally executable. Fix that and it'll work.

Original comment by connor.tumbleson on 31 May 2014 at 11:33