yashsingh1/xdaforums huggingface dataset:
[Android Software Development] iBotPeaches:
Discussion Time

A few days ago, as I sat upgrading smali I realized this was a far more difficult procedure than needed. Smali should be a dependency like all others. It shouldn't be a file system copy of the project in Apktool. So I set off to fix that, basically moving smali to a git submodule and applying patches as needed. I only had two patches for the entire smali project. One of which I could get merged upstream (as per JesusFreke).

However, those patches are only there for one reason: Smali Debugging. The feature that had been broken, returned and had its fair share of bugs for the past 2 years. For a bit of background. 4 years ago, smali debugging through Apktool was one of the only sources to debug closed source applications. Times have changed. JesusFreke has launched a new tool (in Alpha) called Smaliidea which is an intelliJ plugin that does everything Apktool's Smali Debugging did, times 10 - https://github.com/JesusFreke/smali/wiki/smalidea

I would say 90% of my work in Apktool is resource bug fixes to combat the never ending battle of resource obfuscation, AOSP updates and OEM changes. I've had next to 0 time for feature enhancement or changes to smali debugging. Currently, it works but line numbering is off and I couldn't get to work in Eclipse/Netbeans due the lines not allowing to be break-pointed. This is where a change --line-prefix was added to fix that, but point being. It's complicated as hell to do, but when it works line numbers are off.

I really want to strive to bring some consistency to the Apktool's code base, but we have a large amount of code devoted to this smali-debugger. Long story short - I want to remove Smali Debugging and all the codebase around it. I feel all the "major" players that used smali debugging have moved on to different tools. We can write docs and teach people to use Smalidea instead. If you have any opinions to this matter, I wouldn't mind a comment on our Github bug for this - https://github.com/iBotPeaches/Apktool/issues/1061
[Android Software Development] andreya108:
Thanks for good news! I hope you'll sync with master smali, it has a lot of fixes since 2.0.8.
[Android Software Development] DualJoe:
The included AAPT (from 2.0.2) doesn't cover the same processor/compatibility range as the original Google AAPT thus it crashes. Binaries should be targeted at SSE1 not SSE2. This is a simple option to be set in compiler. Would be great if you could fix that.
[Android Software Development] iBotPeaches:
Any help would be appreciated then. I did not change anything from my building procedure and thus have no idea how to set that. If widespread crashes were occurring, I think I would of had at least one bug report on this. So let me know how to toggle this configuration and I'll run some tests on it.
[Android Software Development] DualJoe:
I guess you updated Visual Studio. Latest Visual Studio versions use SSE2 by default. Try /arch:SSE or do it by GUI like described here at the bottom. You can post a test version here if you want and i will test it.
[Android Software Development] bovirus:
[MENTION=3924617]iBotPeaches[/MENTION],

After the latest github updates I cannot compiler the .jar file

Errors in the attached txt
[Android Software Development] Er. Aditya:
same here
[Android Software Development] vasily_pupkin:
./gradlew clean ; ./gradlew applyPatches; ./gradlew fatJar
[Android Software Development] bovirus:
@ vasily_pupkin

Didn't work

gradlew applyPatches

Building SNAPSHOT (master): 183eef

:updateSubmodules FAILED

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':updateSubmodules'.

> Process returned error code. Expression: (result == 0). Values: result = 1

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 12.42 secs
[Android Software Development] bdorr1105:
Hey, I was trying to recompile the SystemUI.apk for the Samsung Galaxy S6 Edge+ and it decompiled fine, however, I am unable to recompile it, this is what is happening when I try. Decompile and Recompile Log are attached for use with Tickle My Android v12.

Edit: I used the command line as well for APK Tool, having errors without making a single mod

C:\Users\Brian\Desktop\APK_Tool>apktool_2.0.2.jar

C:\Users\Brian\Desktop\APK_Tool>apktool if framework-res.apk
I: Framework installed to: C:\Users\Brian\apktool\framework\1.apk

C:\Users\Brian\Desktop\APK_Tool>apktool if twframework-res.apk
I: Framework installed to: C:\Users\Brian\apktool\framework\2.apk

C:\Users\Brian\Desktop\APK_Tool>apktool d SystemUI.apk
I: Using Apktool 2.0.2 on SystemUI.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Brian\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

C:\Users\Brian\Desktop\APK_Tool>apktool b SystemUI.apk
I: Using Apktool 2.0.2
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathNotExist: apktool.yml
at brut.androlib.Androlib.readMetaFile(Androlib.java:256)
at brut.androlib.Androlib.build(Androlib.java:268)
at brut.androlib.Androlib.build(Androlib.java:261)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.directory.PathNotExist: apktool.yml
at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java:105)
at brut.androlib.Androlib.readMetaFile(Androlib.java:251)
... 4 more

C:\Users\Brian\Desktop\APK_Tool>
[Android Software Development] iBotPeaches:
The build system has changed - http://ibotpeaches.github.io/Apktool/build/

./gradlew applyPatches

./gradlew build fatJar proguard

If you have a ton of problems. The upgrade to git submodules probably messed things up. Delete everything, re-clone and run those commands. They work for me on Unix/Windows/Mac alike.
[Android Software Development] Er. Aditya:
wiered i tried the latest steps only , still il give ashot again

thanks mate :)
[Android Software Development] exodius48:
Working fine for me. :highfive:

I tried it on windows 7 x86 , working fine. Log http://pastebin.com/zQUypdAL

Try to use github source. Delete old directory & reclone from github.
[Android Software Development] Ticklefish:
The answer is in your decompile log:

I: Using Apktool 2.0.2
I: Smaling smali folder into classes.dex...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [C:\Users\Brian\AppData\Local\Temp\brut_util_Jar_2907798084411363907.tmp, p, --forced-package-id, 127, --min-sdk-version, 22, --target-sdk-version, 22, --version-code, 22, --version-name, 5.1.1-G928GUBU1AOH8, -F, C:\Users\Brian\AppData\Local\Temp\APKTOOL5354878858024114595.tmp, -0, resources.arsc, -0, res/drawable-ldrtl-xxxhdpi-v4/stat_sys_data_connected_cdma_roam.qmg, -0, res/drawable-ldrtl-xxxhdpi-v4/stat_sys_data_connected_cdma_roam_flash.qmg, -0, res/drawable-ldrtl-xxxhdpi-v4/stat_sys_data_connected_cdma_roam_home.qmg...
[color="red"]...and on and on and on for ages..[/color]

This is Samsung being annoying

again

. A fix may be in a future version of apktool but, for now, let me paraphrase somebody who came up with a temporary solution..

:good:
[Android Software Development] iBotPeaches:
You are killing me with the large posts. Please please use pastebin or something any time you are going to post code over 5 lines. "Before the last changes I never had a problem" is not really a good reason. 25% of the build system changed with the last few commits.

I thought maybe there was an issue with Bitbucket (as I noticed you are cloning from there vs Github). However, I tried cloning from Bitbucket and everything built okay. According to your stacktrace/info log. The GIT commands it is executing are not completing properly. Its possible this is a bug from the new dependency "gitpatcher" I use, but I think its more likely a misconfiguration on your side.
[Android Software Development] and2:
Shouldn't it be

apktool b SystemUI

you have

apktool b SystemUI.apk
[Android Software Development] djdarkknight96:
Ninja'd was gonna say how did all these guys miss that lol
[Android Software Development] DualJoe:
Neither Github nor Bitbucket do work here on Debian:

./gradlew

http://pastebin.com/5HsSQjUM

./gradlew applypatches

http://pastebin.com/qszAsZK9

Looks like JesusFreke's repos are missing.

Edit:

To fix that change URL in .gitmodules (and probably .git/config) to https://github.com/JesusFreke/smali.git ('git' protocol probably needs proper user initialization. 'https' doesn't care on read-only access).

Edit2:

Unfortunately, the aapt binaries are indeed prebuilt and i cannot make any tests regarding SSE builds.
[Android Software Development] iBotPeaches:
Thanks, that was indeed (I think) the problem for those who experienced issues. https://github.com/iBotPeaches/Apktool/commit/ed35a9f72f3a2bb916ae96163683ab2265c2b1bd - This should work for anyone who doesn't have an SSH key with GitHub since we use the public HTTPS vs sign in SSH option.

As for the SSE builds. Windows binaries are cross compiled via Linux, so I have no Visual Studio or anything like that. Googling this issue in regards to AOSP, also brings up nothing. I'm sorry. but I have no idea. You are welcome to investigate this and throw me a pull request here: https://github.com/iBotPeaches/platform_frameworks_base if you come to a solution.
[Android Software Development] bovirus:
[MENTION=290873]ibo[/MENTION]

As I tried toe xplained was some changes in teh source (before last changes all compilation worked fine).

I made changes to .gitmodules and .git/config

url=https://github.com/JesusFreke/smali.git

Now I pass the update step but I cannot apply patches

but failed to apply patches.

The error is

My system is Windows 7 x64.

Another step forward.

After latest changes now the error is

All projects evaluated.

Selected primary task 'applyPatches' from project :

Tasks to be executed: [task ':updateSubmodules', task ':applyPatches']

:updateSubmodules (Thread[main,5,main]) started.

:updateSubmodules

Executing task ':updateSubmodules' (up-to-date check took 0.001 secs) due to:

Task has not declared any outputs.

:updateSubmodules UP-TO-DATE

:updateSubmodules (Thread[main,5,main]) completed. Took 0.512 secs.

:applyPatches (Thread[main,5,main]) started.

:applyPatches

Executing task ':applyPatches' (up-to-date check took 0.162 secs) due to:

Task.upToDateWhen is false.

Creating D:\GIT\Apktool-iBotPeaches\brut.apktool.smali repository...

:applyPatches FAILED

:applyPatches (Thread[main,5,main]) completed. Took 0.209 secs.
[Android Software Development] DualJoe:
Where are the sources/patches to create these binaries?

Are you sure you started with 'gradlew applypatches' and not just 'gradlew'?
[Android Software Development] iBotPeaches:
The source is the android-6.0.0_r1 tag for AOSP. So first you need to download AOSP. Then you'll need frameworks/base replaced with my copy - https://github.com/iBotPeaches/platform_frameworks_base (of branch apktool-mm). If you look at the latest commits of my repo, you will see the changes I made. Mainly removing some of the restrictions aapt has added over the years.

For the building itself. Just build the basic SDK and pull the aapt binary from it.

source build/envsetup.sh
lunch sdk-eng
make sdk
[Android Software Development] bovirus:
[MENTION=4293606]DualJoe[/MENTION]

I'm sure. Is not just gradle. It's

gradlew applypatches
[Android Software Development] DualJoe:
Thanks. Will try it.

Maybe its messed up. Reset the working tree and try again:

git reset --hard

git clean -dxf

git checkout -- .

gradlew applypatches
[Android Software Development] bovirus:
[MENTION=4293606]DualJoe[/MENTION]

d:\GIT\Apktool-iBotPeaches>git reset --hard

HEAD is now at 83f3273 Merge branch 'master' of github.com:iBotPeaches/Apktool

d:\GIT\Apktool-iBotPeaches>git clean -dxf

Removing .gradle/

d:\GIT\Apktool-iBotPeaches>git checkout -- .

d:\GIT\Apktool-iBotPeaches>gradlew applypatches --info

Starting Build

Settings evaluated using settings file 'D:\GIT\Apktool-iBotPeaches\settings.gradle'.

Projects loaded. Root project using build file 'D:\GIT\Apktool-iBotPeaches\build.gradle'.

Included projects: [root project 'Apktool-iBotPeaches', project ':brut.apktool', project ':brut.apktool.smali', project ':brut.j.common', project ':b

ut.j.dir', project ':brut.j.util', project ':brut.apktool.smali:baksmali', project ':brut.apktool.smali:dexlib2', project ':brut.apktool.smali:smali'

project ':brut.apktool.smali:util', project ':brut.apktool:apktool-cli', project ':brut.apktool:apktool-lib', project ':brut.apktool.smali:dexlib2:a

cessorTestGenerator']

Evaluating root project 'Apktool-iBotPeaches' using build file 'D:\GIT\Apktool-iBotPeaches\build.gradle'.

Building SNAPSHOT (master): 83f327

Evaluating project ':brut.apktool' using empty build file.

Evaluating project ':brut.apktool.smali' using empty build file.

Evaluating project ':brut.j.common' using build file 'D:\GIT\Apktool-iBotPeaches\brut.j.common\build.gradle'.

Evaluating project ':brut.j.dir' using build file 'D:\GIT\Apktool-iBotPeaches\brut.j.dir\build.gradle'.

Evaluating project ':brut.j.util' using build file 'D:\GIT\Apktool-iBotPeaches\brut.j.util\build.gradle'.

Evaluating project ':brut.apktool.smali:baksmali' using empty build file.

Evaluating project ':brut.apktool.smali:dexlib2' using empty build file.

Evaluating project ':brut.apktool.smali:smali' using empty build file.

Evaluating project ':brut.apktool.smali:util' using empty build file.

Evaluating project ':brut.apktool:apktool-cli' using build file 'D:\GIT\Apktool-iBotPeaches\brut.apktool\apktool-cli\build.gradle'.

Evaluating project ':brut.apktool:apktool-lib' using build file 'D:\GIT\Apktool-iBotPeaches\brut.apktool\apktool-lib\build.gradle'.

Evaluating project ':brut.apktool.smali:dexlib2:accessorTestGenerator' using empty build file.

All projects evaluated.

Selected primary task 'applyPatches' from project :

Tasks to be executed: [task ':updateSubmodules', task ':applyPatches']

:updateSubmodules (Thread[main,5,main]) started.

:updateSubmodules

Executing task ':updateSubmodules' (up-to-date check took 0.0 secs) due to:

Task has not declared any outputs.

:updateSubmodules FAILED

:updateSubmodules (Thread[main,5,main]) completed. Took 6.157 secs.

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':updateSubmodules'.

> Process returned error code. Expression: (result == 0). Values: result = 1

* Try:

Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 9.337 secs

Stopped 0 compiler daemon(s).

d:\GIT\Apktool-iBotPeaches>
[Android Software Development] exodius48:
Worked for me on windows 7 x86, for proof you can read my post http://xdaforums.com/showpost.php?p=63375008&postcount=3731
[Android Software Development] PatrickMac:
Hey guys,

I'm currently unable to install the framework-res.apk (https://www.dropbox.com/s/3417vhj3tuljpor/framework-res.apk?dl=0) from the custom ROM Temasek for the oneplus one.

It only seems to happen with the framework file of temasek and I'm not sure what the resulting error reveals:

Any ideas to resolve this issue?
[Android Software Development] laura almeida:
Next time search before you post

http://xdaforums.com/showpost.php?p=63272957&postcount=3691
[Android Software Development] PatrickMac:
Thanks,

I actually did search for the error message and didn't find anything.
[Android Software Development] exodius48:
I think i can't upload whole apktool folder because the size is too big , almost ~200MB. My internet connection is too slow. But from error code above, util folder is missing from ':brut.apktool.smali:baksmali' folder , so try this util folder from my pc: http://rghost.net/86y4r94s6

Hope this help you. :)
[Android Software Development] bovirus:
[MENTION=5210243]exodius48[/MENTION]

Thanks. One steps forward.

I cannot explain because I didn't have this folder.

I checked that build.gradle file is different in your util folder that you sent me and into by repository. What's the matter?

Now the errors is

* What went wrong:

A problem occurred evaluating project ':brut.apktool.smali:dexlib2'.

> Project with path ':util' could not be found in project ':brut.apktool.smali:dexlib2'.
[Android Software Development] exodius48:
After i check, in my pc there's no folder util inside ':brut.apktool.smali:dexlib2'

So i don't know about that error above.
[Android Software Development] bovirus:
[MENTION=5210243]exodius48[/MENTION]

The definition are included in my /smali/smali/build.gradle (got from repository)

dependencies {

compile project(':util')

compile project(':dexlib2')

compile depends.antlr_runtime

compile depends.stringtemplate

compile depends.commons_cli

testCompile depends.junit

antlr depends.antlr

jflex depends.jflex

}

Could you send me your smali/smal.build.gradle file?
[Android Software Development] exodius48:
Grab it here http://rghost.net/7D7WFG5Br
[Android Software Development] bovirus:
[MENTION=5210243]exodius48[/MENTION]

I compare the latest file and is different than my file that I got from repository.

I will wait that [MENTION=3801078]iboat[/MENTION]Peaches check repository because I didn't understand why the repository files and your files are different (if you make an update from repository) .

I believe that if now someone started from scratch, clone the repository and try to apply gradlew applyPatches command will get the same my result.

Note; clone works fne all other sw project (ex. smali) and is not the problem.

This the instrcution that I made from DOS prompt

git clone --recursive https://github.com/iBotPeaches/Apktool.git D:\Apktool

d:

cd \Apktool

git submodule update --init --recursive (as explained in changelog - but I tested also without this)

gradlew applyPatches

Are there some instruction wrong?
[Android Software Development] exodius48:
I just use command : git clone https://github.com/iBotPeaches/Apktool.git

I did not use git clone https://github.com/iBotPeaches/Apktool.git and enter path D:\Apktool

d:

Then gradlew.bat applyPatches
[Android Software Development] bovirus:
[MENTION=5210243]exodius48[/MENTION]

gt clone --recursive is reported in How to build (http://ibotpeaches.github.io/Apktool/build/)

git submodule update --init --recursive is reported in changelog (http://ibotpeaches.github.io/Apktool/changes/)

"D:\Apktool" is the path where will the cloned files will be stored.

Note: using

gt clone --recursive https://bitbucket.org/iBotPeaches/Apktool.git

gt clone --recursive https://github.com/iBotPeaches/Apktool.git

The two repositories have different file size/contents (it means that two repositories are not aligned).

I hope that someone clarify one time for all

1. Which is the right repository and why there are two repositories with two file/fodler contents

2. Which are the instruction commands/steps to compile with the latest reposiroy changes

3. Why in Windows7 x64 I had same problems on different PC (5 pc tested).
[Android Software Development] exodius48:
I don't know if the build method has been changed, i just use github clone without recursive. Also command "git submodule update --init --recursive" just for developer.

I just use old method and it worked for me.
[Android Software Development] iBotPeaches:
1. I just checked the repos. They are in sync. With the exception of `gh-pages`, which is Github Pages. So there is no real need for it to be on Bitbucket. The Apktool src tree itself is in sync.

2. The commands are right. If you are cloning a repo (BRAND NEW), then you need to do `git clone --recursive`. If you already had a repository and just updated it, you need to run the `git submodule update --init --recursive`. As this updates the smali source.

3. You are having troubles everywhere, because you still aren't doing something right. I investigated this problem a few days ago when you reported it. I updated the build docs as such and everything works across multiple Windows computers.

You just need to triple check everything. Delete the entire folder. Reclone using git clone --recursive, check that the smali folder has contents. If it doesn't, this means you didn't update the submodule and have some problem pulling submodules. The build instructions also have a requirement of "git", always had, but never was enforced until now.

If you can't execute `git` at command line (IE in your $PATH variable), then the build will fail. If all these steps are met. Proper java version (7), git installed and accessible via command line (Windows console, not some Git BASH prompt), cloned correctly with smali submodule, then and only then will this build worked.

If after all of this, you still can't get it. I'd ask that you just wait for binaries. Or take this to a bug report on GitHub, as you are cluttering this thread majorly with stacktraces.
[Android Software Development] bovirus:
[MENTION=3924617]iBotPeaches[/MENTION]

Please remind tha until 15 days ago (before latest Apktool changes) the Apktool compilation/update worked fine with the same git/java/javac commands.

Please take care that with some git/java.exe/javac.exe command other github project (like ex. smali/baksmali) works fine.

git.exe/java.exe (JRE)/javac.exe (JDK) are in a folders pointed by path.

The JDK/JRE is 1.7.0.80

I already cloned from scractch a lot of times but the result is the same (in many computers - not only one - all computer with Windows 7 Professional/Enterprise x64)

Clone from scractch -> OK

Gradlew applypatches -> up to 50% then reported in error (that I pasted befroe)

smali folder has contents. with many files/folders.

What kind of other check can i do?

The error (with --stacktrace) is

Caused by: org.gradle.api.UnknownProjectException: Project with path ':util' could not be found in project ':brut.apktool.smali:baksmali'.

The "util" folder is into brut.apktool.smali folder (not into 'brut.apktool.smali:baksmali' folder as reported by gradlew script command).

Into brut.apktool.smali/smali and brut.apktool.smali/baksmali fodlers i just have "build.gradle" file and "src" subfolder
[Android Software Development] iBotPeaches:
You have to stop telling me that it worked 15 days ago. That literally means nothing to me. I changed the system to use git submodules, so whatever worked is no longer applicable. Just because I built Gingerbread, doesn't mean I can build Lollipop. Build systems change and you have to meet those requirements.

I have sat here helping you for multiple days. I can't spend any more time in this, especially when you seem to be the only one experiencing problems. Others who reported build problems, did not run right commands and that fixed their issue. There are no more checks you can do. Wait for a binary. Please no more posts about this in this thread.

To further show you. I spun up a new Windows 7 VM. I installed JDK 1.7, git, confirmed my $PATH variable was correct and here is the log - http://pastebin.com/qs1yZfH5 (no error)
[Android Software Development] bovirus:
I tested the same procedure like you.

Cloning is exactly bytes/fiels/steps the same.

The problem is gradlew.bat applyPatches

Report the error that I apsted before.

I checked that the patches wre downlaoded in gradle/smali-patches

The problem is about Applying patches.

Which command was used to apply patches?

Which is the contents of your smali/baksmali and smali/smali folders?

Just build.gradle file and src subfolder?

Report about gradle

D:\GIT\Apktool>gradlew -v

------------------------------------------------------------

Gradle 2.3

------------------------------------------------------------

Build time: 2015-02-16 05:09:33 UTC

Build number: none

Revision: 586be72bf6e3df1ee7676d1f2a3afd9157341274

Groovy: 2.3.9

Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013

JVM: 1.7.0_80 (Oracle Corporation 24.80-b11)

OS: Windows 7 6.1 amd64