5,599,616 Members 43,347 Now Online
XDA Developers Android and Mobile Development Forum

[UTIL][Feb 02 2013] Apktool v1.5.2 - a tool for reverse engineering apk files

Tip us?
 
ilie321
Old
#831  
ilie321's Avatar
Senior Member
Thanks Meter 221
Posts: 312
Join Date: Feb 2011
Quote:
Originally Posted by M4gicM@ View Post
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
 
ingbrzy
Old
#832  
ingbrzy's Avatar
Senior Member
Thanks Meter 444
Posts: 637
Join Date: Mar 2011
Location: Kosice

 
DONATE TO ME
Quote:
Originally Posted by ilie321 View Post
thanks i tested this on win xp sp3 x86 same error
XP is still live..? Damn...

~Tapatalk~
Xiaomi Mi2, Xiaomi Mi3, Xiaomi Redmi
MIUIv5 (Android 4.3)
_______________________________________________
MIUIAndroid Team Member
MIUI CZECH & SLOVAK Developer and Translator
MIUI Multilang Project leader HERE
MIUI CZECH & SLOVAK FORUM
Twitter: @ingbrzy
 
CosmicDan
Old
#833  
CosmicDan's Avatar
Senior Member
Thanks Meter 3787
Posts: 3,961
Join Date: Jun 2009
Location: Central Coast

 
DONATE TO ME
Quote:
Originally Posted by ilie321 View Post
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).

XtreamerMobile Developer


My GitHub | My Apps on AppBrain


Goodbye Xperia 2011 scene - on to greater things

Current Community Projects:
Turbo Tools - Suspended
TBA...

 
prabhjots
Old
#834  
prabhjots's Avatar
Senior Member
Thanks Meter 69
Posts: 337
Join Date: 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?
 
pakjebakmeel
Old
(Last edited by pakjebakmeel; 14th November 2012 at 11:43 AM.)
#835  
pakjebakmeel's Avatar
Senior Member
Thanks Meter 82
Posts: 152
Join Date: Apr 2012
Location: Ankeveen
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)
 
CosmicDan
Old
#836  
CosmicDan's Avatar
Senior Member
Thanks Meter 3787
Posts: 3,961
Join Date: Jun 2009
Location: Central Coast

 
DONATE TO ME
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

XtreamerMobile Developer


My GitHub | My Apps on AppBrain


Goodbye Xperia 2011 scene - on to greater things

Current Community Projects:
Turbo Tools - Suspended
TBA...

 
pakjebakmeel
Old
(Last edited by pakjebakmeel; 14th November 2012 at 01:04 PM.)
#837  
pakjebakmeel's Avatar
Senior Member
Thanks Meter 82
Posts: 152
Join Date: Apr 2012
Location: Ankeveen
Quote:
Originally Posted by CosmicDan View Post
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.
The Following User Says Thank You to pakjebakmeel For This Useful Post: [ Click to Expand ]
 
paulobrien
Old
#838  
paulobrien's Avatar
Senior Member
Thanks Meter 5673
Posts: 4,437
Join Date: Nov 2003
Location: Norwich
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
Follow me on Twitter - http://twitter.com/paulobrien

Follow MoDaCo Android on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

The Following 14 Users Say Thank You to paulobrien For This Useful Post: [ Click to Expand ]
 
CosmicDan
Old
#839  
CosmicDan's Avatar
Senior Member
Thanks Meter 3787
Posts: 3,961
Join Date: Jun 2009
Location: Central Coast

 
DONATE TO ME
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

XtreamerMobile Developer


My GitHub | My Apps on AppBrain


Goodbye Xperia 2011 scene - on to greater things

Current Community Projects:
Turbo Tools - Suspended
TBA...

 
iBotPeaches
Old
(Last edited by iBotPeaches; 14th November 2012 at 04:08 PM.)
#840  
iBotPeaches's Avatar
Senior Member - OP
Thanks Meter 2042
Posts: 693
Join Date: Apr 2011
Location: KCK

 
DONATE TO ME
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.

The Following 7 Users Say Thank You to iBotPeaches For This Useful Post: [ Click to Expand ]
Tags
apktool, apktools, customise apk, decompile, edit apk, recompile, reverse
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes