yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] aiah:
Can any one tell me if it should bepossible to modify framework-res.apk with this tool.

I did:

- apktool d ....

- modify values/colors.xml

- apktool b .....

- jarsign .....

After upload and reboot, nothing works anymore.
[G1 Android Development] Corey@rabbit:
The last step is your problem, don't sign framework.
[G1 Android Development] AudioFiend:
[Q] Right.... I am doing something stupid here.

Why is it when I try and run apktool I get:-

"'java' is not recognized as an internal or external command,

operable program or batch file.

Can't work it out, read every Google link on apktool..

I have downloaded apktool1.4.1 and apktool-install-windows-r04

and extracted

aapt.exe apktool.jav apktool.bat into my android-sdk/tools folder[see below]as I have set the PATH in environment variables when setting up the Java-Eclipse-SDK install.

C:\Java\sdk1.7.0_01\bin

Now in cmd C:\User\Nick> What would be my next step?..As I can't get apktool to run.
[G1 Android Development] tommytomatoe:
From C:\User\Nick, type "java"

Tell us what you get.

tapatalk signature here. lovely.
[G1 Android Development] AudioFiend:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Nick>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument

-splash:<imagepath>
show splash screen with specified image
See http://java.sun.com/javase/reference for more details.

C:\Users\Nick>
[G1 Android Development] liamstears:
Can anyone help??
[G1 Android Development] tommytomatoe:
Ok. From your previous post you have thr jjava sdk ... Download the jre and jdk from oracle and add those to.your path. Then try apktool again :-)

tapatalk signature here. lovely.
[G1 Android Development] pendo:
Do you need to do any smali edits? If not, try using the -s switch

apktool d -s HtcLaputa.apk
[G1 Android Development] AudioFiend:
Excellent Added Jre and jdk to the PATH.

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Java\bin;C:\Java\jre\bin;

I removed aapt.exe/apktool.bin/apktool.jav

And Added into the JDK bin[C:\Java\bin and now apktool runs fine. THANK You

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Nick>apktool
Apktool v1.4.1 - a tool for reengineering Android apk files
Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com>
Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)

Usage: apktool [-v|--verbose] COMMAND [...]

COMMANDs are:

d[ecode] [OPTS] <file.apk> [<dir>]
Decode <file.apk> to <dir>.

OPTS:

-s, --no-src
Do not decode sources.
-r, --no-res
Do not decode resources.
-d, --debug
Decode in debug mode. Check project page for more info.
-f, --force
Force delete destination directory.
-t <tag>, --frame-tag <tag>
Try to use framework files tagged by <tag>.
--keep-broken-res
Use if there was an error and some resources were dropped, e.g.:
"Invalid config flags detected. Dropping resources", but you
want to decode them anyway, even with errors. You will have to
fix them manually before building.
b[uild] [OPTS] [<app_path>] [<out_file>]
Build an apk from already decoded application located in <app_path>.

It will automatically detect, whether files was changed and perform
needed steps only.

If you omit <app_path> then current directory will be used.
If you omit <out_file> then <app_path>/dist/<name_of_original.apk>
will be used.

OPTS:

-f, --force-all
Skip changes detection and build all files.
-d, --debug
Build in debug mode. Check project page for more info.

if|install-framework <framework.apk> [<tag>]
Install framework file to your system.

For additional info, see: http://code.google.com/p/android-apktool/

C:\Users\Nick>

What i cant figure out now is the .apk file folder placement????

apktool d [filename].apk [folder name] is that correct? So the .apk file is placed into [X name folder]? can this folder be placed anywhere on the DIR?? Also i have seen people say that the apktool files ( aapt.exe,apktool.bin, apktool.jav ) needs to be in the folder with the .apk file? If this is correct then the [ X name folder] needs tobe in the java jdk bin??
[G1 Android Development] liamstears:
I get the same error....
[G1 Android Development] mattmanwrx:
I have apktool in a folder on my desktop with both apktool files and aapt...

I just place the .apk in the same folder, and then use the options... the [folder name] directory is the folder that is created when decompiling the apk..

For instance, if I was to use it to decompile blufrost (my theme) then I would type apktool d blufrost.apk blufrost it would then create the folder blufrost and decompile to in there...

(i think that is all correct, I usually use apk manager for decompiling... it has a nice UI... :)

Edit: you may need to install the framework-res.apk for the resources table... there is loads of info about for that...
[G1 Android Development] pendo:
When I first read that, I thought it was baksmali throwing the error, but it's not..baksmali's fine.

Ok, so I made a guess that you are working with Cappy's rom so I grabbed it and tried to decompile, and sure enough I get the same error. I did a resource dump and here's what I assume it's complaining about:

Package Groups (2)
Package Group 0 id=2 packageCount=1 name=com.htc
Package 0 id=2 name=com.htc typeCount=1
type 0 configCount=1 entryCount=6
spec resource 0x02010000 com.htc:id/title_2_pull: flags=0x00000000
spec resource 0x02010001 com.htc:id/title_2_left: flags=0x00000000
spec resource 0x02010002 com.htc:id/title_2_img_left: flags=0x00000000
spec resource 0x02010003 com.htc:id/title_2_right: flags=0x00000000
spec resource 0x02010004 com.htc:id/title_2_img_right: flags=0x00000000
spec resource 0x02010005 com.htc:id/title_2_txt_1x2_coat: flags=0x00000000
config 0
resource 0x02010000 com.htc:id/title_2_pull: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
resource 0x02010001 com.htc:id/title_2_left: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
resource 0x02010002 com.htc:id/title_2_img_left: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
resource 0x02010003 com.htc:id/title_2_right: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
resource 0x02010004 com.htc:id/title_2_img_right: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
resource 0x02010005 com.htc:id/title_2_txt_1x2_coat: t=0x12 d=0x00000000 (s=0x0008 r=0x00)
Package Group 1 id=127 packageCount=1 name=com.htc.laputa
.
.
.
...

And that fails here AndrolibResources.java

LOGGER.info("Loading resource table from file: " + apk);
ResPackage[] pkgs = getResPackagesFromApk(
new ExtFile(apk), resTable, true);

[COLOR="Red"]if (pkgs.length != 1) {
throw new AndrolibException(
"Arsc files with zero or multiple packages")[/COLOR];
}

Don't know that there's an easy way to get around that. Might want to pm cappy on how they did that.
[G1 Android Development] liamstears:
I only need to change 1 xml, I have tried using the exact same compiled xml from another apk and copied it over to the original laputa apk but I get fc's :-(
[G1 Android Development] pendo:
I've had some success in the past using another apk as a "workspace" to get a compiled xml that I later inject into a problem apk that I couldn't directly work with. But it doesn't always work. What are you changing in the xml?
[G1 Android Development] liamstears:
Yeh thats what I tried but it didnt work

Only trying to change colors of text in notifications
[G1 Android Development] pendo:
ouch....

I would've expected that to be ok.

The 2 things I can think of would be to either somehow mod the apk so that it can work with apktool, or if you're handy in java you might be able to make some adjustments to the source then compile a custom apktool.jar to use.

Sorry I don't think I can offer much help on this one, bud. Hopefully someone else can chime in with some more helpful info.
[G1 Android Development] shorty1483:
please delete, wrong section :D
[G1 Android Development] pendo:
@tommytomatoe,

clean out your inbox. :-/
[G1 Android Development] tommytomatoe:
Lol. I deleted a bunch last week when it filled up but didn't realize It's full again. I went ahead and deleted about ten messages for now. I'll do more when I get to a computer. How've you been?

Sent for the EVO Classic.
[G1 Android Development] pendo:
Howdy bro! I sent you a pm. :)
[G1 Android Development] tommytomatoe:
Howdy! I responded. Thanks for sharing :-)

Sent for the EVO Classic.
[G1 Android Development] Droidzone:
@Brut.all,

Maven fails to build...
[G1 Android Development] pendo:
OK...I compiled a new apktool.jar and have been able to successfully decompile Vending 3.3.11.

To be honest, I feel like I'm playing in a part of the pool that's waaay deeper than I should be playing in right now so I'm consequently not super confident in what I've done. But I've privately shared this with a few devs and so far they say it's working and suggested that I post it.

This is all based on brut.all's work, and my edits were all in the vein of trying to update the api definitions so that we could decompile the newest Vending.

apktool-1.4.3.jar

It's versioned one dot higher, but in cli it will report "apktool v1.4.3_pendo" so it can be easily distinguished from brut.all's official releases. Please keep that in mind when you use this, and if there are any new errors it's highly likely it's my fault not brut.all's

Thanks again brut.all for providing this wonderful work, and allowing us the chance to play with it :)

EDIT:

Brut.all has updated apktool officially, please disregard!!
[G1 Android Development] Brut.all:
Hmm... what did you do exactly? Did you try to build apktool-smali from sources or something? brut.apktool.smali:smali:jar:1.2.6-brut5 should depend on brut.apktool.smali:dexlib:jar:1.2.6-brut5, not 1.2.6-brut6-SNAPSHOT and it can be verified very easily: http://android-apktool.googlecode.c...smali/smali/1.2.6-brut5/smali-1.2.6-brut5.pom. Also it works for me:

Downloading: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/smali/1.2.6-brut5/smali-1.2.6-brut5.pom
Downloaded: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/smali/1.2.6-brut5/smali-1.2.6-brut5.pom (6 KB at 14.2 KB/sec)
Downloading: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/smali-pom/1.0-brut1/smali-pom-1.0-brut1.pom
Downloaded: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/smali-pom/1.0-brut1/smali-pom-1.0-brut1.pom (2 KB at 5.8 KB/sec)
Downloading: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/dexlib/1.2.6-brut5/dexlib-1.2.6-brut5.pom
Downloaded: http://android-apktool.googlecode.com/svn/m2-releases/brut/apktool/smali/dexlib/1.2.6-brut5/dexlib-1.2.6-brut5.pom (941 B at 2.7 KB/sec)

Vending 3.3.11 is supported by vanilla apktool - I have added support for API13 resources two days ago ;-)
[G1 Android Development] pendo:
Lolol....that's murphy's law working on me. I must've barely missed you doing that! I know when I first compiled it a few days ago it didn't work. (I have all subproject's local as well, not just brut.apktool)

I actually had it built early Friday, but like I said I wasn't too confident yet and was getting some feedback.

I will edit my post and remove the links. :)
[G1 Android Development] jbbandos:
Hi Brut.all, where can I download it? The code.google.com site still has the version from May 15.
[G1 Android Development] Brut.all:
apktool1.4.2.31e6dc5.jar

I will release it as v1.4.2 soon. I want to update smali, maybe do some other quick fixes.
[G1 Android Development] Brut.all:
Hmmm... Maven didn't even search for smali, but dexlib, util, etc. It seems you have smali installed to your local repository and it's somehow broken. Try to remove $HOME/.m2/repository/brut and then rerun "mvn package".
[G1 Android Development] pendo:
@Brut.all,

curious did you go ahead and include the api 14 changes as well? I know the main hang up (for me anyway) was the api 13 stuff, but since I had api 14 sdk available I just used it.
[G1 Android Development] Brut.all:
I think there aren't any changes in resources in API14. I don't see them in the docs and I was able to decode ICS apks, including framework.

These tests didn't fail - they just couldn't be run because of: "/tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdpi-finger-keyssoft-12key-navhidden-dpad: error: Invalid directory name, unable to add.". What's wrong with that name? ;-) Maybe it's too long for some OSes or file systems. Could you try to create such file/directory by yourself and find out, what's the problem?
[G1 Android Development] Droidzone:
No issues.. :)

droidzone@supernova:/$ ls -l '/tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdp'
total 0
droidzone@supernova:/$
[G1 Android Development] Brut.all:
"ls -l" shows files in a directory, doesn't create one. Try: "mkdir /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdp" or "touch /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdp".
[G1 Android Development] Droidzone:
I had created that folder with mkdir and then listed it for you ;)

droidzone@supernova:/$ mkdir /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdpa
droidzone@supernova:/$ touch /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdp
droidzone@supernova:/$
[G1 Android Development] Brut.all:
I've just noticed you have accidentally shorten the name:

/tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdpi-finger-keyssoft-12key-navhidden-dpad
/tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdp
[G1 Android Development] Droidzone:
droidzone@supernova:~$ mkdir /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdpi-finger-keyssoft-12key-navhidden-dpad
droidzone@supernova:~$ touch /tmp/BRUT3805755791944609948.tmp/testapp-orig/res/values-mcc004-mnc4-en-rUS-sw100dp-w200dp-h300dp-xlarge-long-land-television-night-xhdpi-finger-keyssoft-12key-navhidden-dpadd
droidzone@supernova:~$

Still fine :)
[G1 Android Development] pendo:
OK...there were some things bugging me. So I checked the times on the files I had in my trash bin and compared it with the git log times on your repository. Right around the same time you had your first commit is around the time I had a working apktool.....imagine that?!?! I actually got to a point where I wanted to start from scratch again, and I did download a fresh set from github late Friday night.

But here's what I'm unclear on....I originally thought that since I had cloned all the subparts a while back that I was solely dealing with local files (no new git commands either), but now I see that with maven that wasn't the case. It seems like it doesn't matter what you have locally, as maven is going to update it regardless.

Oh, and I commented out that test above in my last builds, lol.

Haha...well, I think I'll go crawl back in my hole and do more reading now....
[G1 Android Development] Brut.all:
If you're in the Maven project you'll build it from your local sources. Maven will search for all dependencies in its local repository first ($HOME/.m2/repository) and then in the internet. Artifacts are installed into local repository when Maven downloads dependencies or when you do a "mvn install".

E.g. if there are 2 projects where A depends on B and you want to build them both from sources, run "mvn install" for B and then build A - it should use B built by you and stored in the local repo. If you build A before B then Maven will automatically download B and your changes in it will be ignored. Of course if you then do "mvn install" for B and build A, you will get your changes in B.

Also non-snapshot versions of a software should be never ever modified by you. They should uniquely identify some state of a software and should be consistent between your computer, remote repos, etc. This is the main reason why Maven downloads artifacts from the internet without asking - if your project depends on some other project in some version and Maven will find it in remote repos, it'll download it, because it assumes it's exactly what you want

If you download project A v1.0 which depends on B v1.5 and you want to build A with your changes to B, then you should:

- change B version to e.g.: v1.6-SNAPSHOT

- add your fixes to B

- change A version to V1.1-SNAPSHOT

- change A so it depends on B v1.6-SNAPSHOT

This way you won't have problems with Maven downloading dependencies, because there won't be (most probably) a 1.6-SNAPSHOT in the repos.

If you build multi-pom project from the root pom (directory with apktool-cli and apktool-lib subdirs), Maven will find inter-dependencies without installing them. You can download apktool, enter root dir, run "mvn package" and then apktool-cli will find local apktool-lib project, so your changes to apktool-lib will be immediately visible in apktool-cli build - you won't have to "mvn install" apktool-lib. But if you run "mvn package" from apktool-cli directory, Maven will look for apktool-lib in $HOME/.m2/repository and in the internet.
[G1 Android Development] tommytomatoe:
Brut we are all happy to see your presence in these parts :-)

Sent for the EVO Classic.
[G1 Android Development] pendo:
Awesome!!! Thank you for this. I will be re-reading, for sure to make certain I absorb this properly.
[G1 Android Development] pendo:
Newest Vending has some v14 sdk qualifiers in it.
[G1 Android Development] Brut.all:
Is there something newer than 3.3.11? I can't find anything and as I said earlier I can decompile&build 3.3.11 successfully.
[G1 Android Development] neoobs:
I can't decompile the newest vending apk, it screams about a multiple resource
[G1 Android Development] pendo:
That's the newest that I'm aware of. When I decompile I have layout-v14, and values-v14 directories. But interestingly where I ran into the issue was in menu-v11/actions.xml.

<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@id/actions_grp">
<item android:icon="@drawable/ic_menu_market_search" android:id="@id/search_button" android:title="@string/search_hint" android:showAsAction="always|[COLOR="Red"]collapseActionView[/COLOR]" />
<item android:icon="@drawable/ic_menu_market_share" android:id="@id/share_button" android:visible="false" android:title="@string/content_description_share" android:showAsAction="never" />
<item android:icon="@drawable/ic_menu_market_explore" android:id="@id/explore_button" android:visible="false" android:showAsAction="never" />
</group>
</menu>

The value I highlighted was just added in api-14. (see Menu Resource)

Until I added that, I kept getting compiling error because it was recognizing it as a string, rather than its associated value in attr.xml (value=8)
[G1 Android Development] Brut.all:
Did you install a framework for API14? I got it decoded as "always|collapseActionView".
[G1 Android Development] pendo:
I'm assuming the only reason it decompiles is because it treats it as a string value, though.

I'm not sure exactly why it's happening actually, because before I posted in your thread I, too, tested by decompiling and recompiling. I did not receive any errors then. It was only after I started modding the market that I ran into the issue. Interestingly, the value wasn't in framework-res that I extracted from the system.img in sdk-14 files. I manually added it to attr.xml, recompiled then used the resources.arsc from it as a new 1.apk in apktool/framework.
[G1 Android Development] Brut.all:
No, it's decoded as "always" using API13 framework and as "always|collapseActionView" using API14, so it definitely decodes 0xa value.

And this is the reason why it was decompiled as "always" - there was no collapseActionView attr in your framework, so apktool couldn't decode it correctly. I don't know why you didn't have it in framework-res.apk extracted from system.img, but it's for sure in $SDK/platforms/android-14/android.jar .
[G1 Android Development] pendo:
Indeed it is. Am I correct in that this attr value is stored as part of resources.arsc?
[G1 Android Development] pendo:
Let me ask this then....what would happen if you were to use resources.arsc from android.jar in android-framework.jar in apktool?

I'm confused why that didn't work :-)
[G1 Android Development] pendo:
Hi Brut.all,

Hey I'm having a problem during decompile I think. I have strange fc's in the Market that only happen when viewing certain apps. I believe it's something going wrong with xml decompile because if I decode using the -r switch the problems go away. Alternately, if I use the -s switch the same problem returns. This is just testing by decoding/rebuilding with no mods.

I'm not sure if this means anything, but I did an aapt resources dump of the original and the apktool decompiled/recompiled version and I found some flags that were different. An example, in the original there is

spec resource 0x7f010000 com.android.vending:attr/childBackgroundDrawable: flags=0x00000000

and the apktool version has:

spec resource 0x7f010000 com.android.vending:attr/childBackgroundDrawable: flags=0x40000000

This difference is found with several resource id's, and the difference is always the same. Also the apktool version adds (PUBLIC) to some which I'm sure is not a problem.

My best guess is that it's a string error somewhere.
[G1 Android Development] Lunchbox115:
I have problems with decompiling the SystemUI.apk from Teamhacksung's Ice Cream Sandwich - Port for the Galaxy S (http://xdaforums.com/showthread.php?p=19729446), build 3.

apktool-version: 1.4.1

I can decompile the framework-res.apk without any problems, but if I try the same with SystemUI.apk, I get this:

Or can I just copy out all the files from the *.apk with 7zip?