Post Reply

[UTIL][Oct 5 2014] Apktool v2.0.0 RC2 - a tool for reverse engineering apk files

OP iBotPeaches

14th November 2012, 05:54 AM   |  #831  
ilie321's Avatar
Senior Member
Thanks Meter: 259
 
419 posts
Join Date:Joined: Feb 2011
Quote:
Originally Posted by M4gicM@

This is most likely because you are on a 64bit machine. Try uname - a to verify. aapt is a 32bit binary so you will need to get the approprite i386 libs to run.

type this

Code:
sudo apt-get update
sudo apt-get install ia32-libs
this will fix the errors where you get the result
Code:
bash: /aapt: No such file or directory

thanks i tested this on win xp sp3 x86 same error
14th November 2012, 05:57 AM   |  #832  
ingbrzy's Avatar
Senior Member
Flag Kosice
Thanks Meter: 445
 
638 posts
Join Date:Joined: Mar 2011
Donate to Me
More
Quote:
Originally Posted by ilie321

thanks i tested this on win xp sp3 x86 same error

XP is still live..? Damn...

~Tapatalk~
14th November 2012, 06:27 AM   |  #833  
CosmicDan's Avatar
Senior Member
Flag Central Coast
Thanks Meter: 3,812
 
3,970 posts
Join Date:Joined: Jun 2009
Donate to Me
More
Quote:
Originally Posted by ilie321

thanks i tested this on win xp sp3 x86 same error

"No such file or directory" means there is no such file or directory. Make sure the path is correct or that you've added the location of aapt to the PATH in bash. Are you using GnuWin32 or Cygwin? I'm not sure if you can use the linux aapt binary with Cygwin.

Either way, if it was an architecture or binary issue, it would show "could not execute aapt" instead of "no such file or directory".

If the errors shows "/aapt" I think it's looking for it in root, change it to ./aapt for current working folder. But best practice is to put it somewhere in your PATH - for GnuWin32 that'd be system32 or for cygqwin that'd be cygwin/usr/bin/ (I think).
14th November 2012, 08:54 AM   |  #834  
prabhjots's Avatar
Senior Member
Thanks Meter: 71
 
386 posts
Join Date:Joined: Jul 2012
Excuse me if I'm asking stupid questions, I'm a newbie to Android Dev.

Am I right in saying that the tool doesn't currently work with Android 4.2 APKs? I tried decompiling, editing (trying to add a new language dictionary) and recompiling the 4.2 Android Keyboard. But it wouldn't compile.
The error
Code:
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
D:\apktool\LatinImeGoogle_signed.apk\res\layout\more_suggestions.xml:4: error: No resource identifier found for attribute 'keyLetterSize' in package 'com.android.inputmethod.latin'
D:\apktool\LatinImeGoogle_signed.apk\res\layout\more_suggestions.xml:4: error: No resource identifier found for attribute 'keyLabelSize' in package 'com.android.inputmethod.latin'
D:\apktool\LatinImeGoogle_signed.apk\res\layout\more_suggestions.xml:4: error: No resource identifier found for attribute 'keyHintLetterRatio' in package 'com.android.inputmethod.latin'
and so on it goes for the entire list of resources.

Is there something I'm doing wrong?

Next, I tried changing the package name in AndroidManifest.xml from:
Code:
<manifest android:versionCode="1700" android:versionName="JellyBeanMR1-448013" coreApp="true" package="com.google.android.inputmethod.latin"
  xmlns:android="http://schemas.android.com/apk/res/android">
to
Code:
<manifest android:versionCode="1700" android:versionName="JellyBeanMR1-448013" coreApp="true" package="com.android.inputmethod.latin"
  xmlns:android="http://schemas.android.com/apk/res/android">
and then the compile works correctly.

however, the size of the new apk now becomes around 8.7 MB instead of the original 12 MB. This, despite adding a 400 KB .dict file.

Am I doing something wrong?
14th November 2012, 11:21 AM   |  #835  
pakjebakmeel's Avatar
Senior Member
Flag Ankeveen
Thanks Meter: 83
 
159 posts
Join Date:Joined: Apr 2012
Ok, so when trying to install the framework-res.apk from the factory image v4.2 (TAKJU/JOP40C) using the version from post #828 in this thread:

Code:
java -Xmx256M -jar ~/Downloads/apktool-cli-1.5.1-SNAPSHOT.jar if ~/Downloads/framework-res.apk
Code:
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x01080291 drawable/ic_ab_back_holo_dark, config=-xhdpi
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:197)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:166)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:131)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:106)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:40)
	at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:459)
	at brut.androlib.Androlib.installFramework(Androlib.java:491)
	at brut.apktool.Main.cmdInstallFramework(Main.java:219)
	at brut.apktool.Main.main(Main.java:74)
Or:

Code:
java -Xmx256M -jar ~/Downloads/apktool-cli-1.5.1-SNAPSHOT.jar d ~/Downloads/framework-res.apk ~/Downloads/framework-res
Code:
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x01080291 drawable/ic_ab_back_holo_dark, config=-xhdpi
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:197)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:166)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:131)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:106)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:390)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:56)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:48)
	at brut.androlib.Androlib.getResTable(Androlib.java:54)
	at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:170)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:99)
	at brut.apktool.Main.cmdDecode(Main.java:135)
	at brut.apktool.Main.main(Main.java:70)
Last edited by pakjebakmeel; 14th November 2012 at 11:43 AM.
14th November 2012, 12:48 PM   |  #836  
CosmicDan's Avatar
Senior Member
Flag Central Coast
Thanks Meter: 3,812
 
3,970 posts
Join Date:Joined: Jun 2009
Donate to Me
More
Dude if you saw iBot's last post, 1.5.1 has not been updated for 4.2 yet. It only recently hit AOSP so you'll have to wait.

Sent from Xperia Play (R800a) on Turbo UI with Tapatalk
14th November 2012, 01:00 PM   |  #837  
pakjebakmeel's Avatar
Senior Member
Flag Ankeveen
Thanks Meter: 83
 
159 posts
Join Date:Joined: Apr 2012
Quote:
Originally Posted by CosmicDan

Dude if you saw iBot's last post, 1.5.1 has not been updated for 4.2 yet. It only recently hit AOSP so you'll have to wait.

Sent from Xperia Play (R800a) on Turbo UI with Tapatalk

Thanks, well it said:

Quote:

4.2 is at AOSP now. Working on some updates.

and some time after he said:

Quote:

Added SDK API 17 framework

So I thought it supported the latest 4.2 with that API level 17. Probably my bad but it sounded like it was supposed to work now.
Last edited by pakjebakmeel; 14th November 2012 at 01:04 PM.
The Following User Says Thank You to pakjebakmeel For This Useful Post: [ View ]
14th November 2012, 02:21 PM   |  #838  
paulobrien's Avatar
Senior Member
Flag Norwich
Thanks Meter: 5,683
 
4,437 posts
Join Date:Joined: Nov 2003
Good afternoon folks.

I've made a super-quick change to fix the issue with duplicate resources in 4.2, which is actually caused by the additional support for RTL languages.

- You can view my changes in this commit - https://github.com/paulobrien/Apktoo...96961633988718
- I have submitted a pull request here - https://github.com/iBotPeaches/Apktool/pull/63
- You can download and build yourself in the interim from my github - https://github.com/paulobrien/Apktool

P
The Following 14 Users Say Thank You to paulobrien For This Useful Post: [ View ]
14th November 2012, 02:34 PM   |  #839  
CosmicDan's Avatar
Senior Member
Flag Central Coast
Thanks Meter: 3,812
 
3,970 posts
Join Date:Joined: Jun 2009
Donate to Me
More
Nice work Paul.

Yes the new apktool adds support for SDK version 17, but in case you didn't notice it is marked as preview release.

Sent from Xperia Play (R800a) on Turbo UI with Tapatalk
14th November 2012, 04:03 PM   |  #840  
iBotPeaches's Avatar
OP Senior Member
Flag KCK
Thanks Meter: 2,166
 
709 posts
Join Date:Joined: Apr 2011
Donate to Me
More
Thanks for the help.

Upon first glance (now that the dev docs have updated). We are dealing with just a couple of new resources/configs. I'll probably check aapt itself though, as sometimes Android doesn't keep their docs up to date :/

Density
public static final int DENSITY_DPI_UNDEFINED - 0 (0x00000000)
Layout
public static final int SCREENLAYOUT_LAYOUTDIR_LTR - 64 (0x00000040)
public static final int SCREENLAYOUT_LAYOUTDIR_MASK - 192 (0x000000c0)
public static final int SCREENLAYOUT_LAYOUTDIR_RTL - 128 (0x00000080)
public static final int SCREENLAYOUT_LAYOUTDIR_SHIFT - 6 (0x00000006)
public static final int SCREENLAYOUT_LAYOUTDIR_UNDEFINED - 0 (0x00000000)


With new configs of...
public int densityDpi

EDIT: Also 2 configurations were deprecated. Don't know if it really matters if we remove them in Apktool, but I'll figure it out later.
public static final int ORIENTATION_SQUARE
public static final int TOUCHSCREEN_STYLUS


I will take a peek into aapt to see how the order of the new localizations should be done and get an update out. I'll use Paul's pull as a base, and add the remaining resource flags in. Then we will have a PR2, then I'll try and get Proguard working. Then public release of v1.5.1.

I also got my hands on a OPPO Finder ROM and that ROM has its own configs that require its own customized aapt for building. I'll see about getting source DIFFs from them (OPPO Chinese Company) to expand Apktool to support that strange company that doesn't abide by Android standards.



JesusFreke is also re-doing dexlib for smali, but I'll wait until he pushes a new version and we will quickly release a new Apktool whenever that happens.


Please no "Apktool doesn't work w/ 4.2" until I push Apktool v1.5.1 PR 2.
Last edited by iBotPeaches; 14th November 2012 at 04:08 PM.

The Following 7 Users Say Thank You to iBotPeaches For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
apktool, apktools, customise apk, decompile, edit apk, recompile, reverse
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software Development by ThreadRank