Open mindrunner opened 5 years ago
hi
first try a round trip with apktool. does that work?
[le@w530]: /tmp/apk>$ apktool d app.apk
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
I: Using Apktool 2.4.0 on app.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
S: WARNING: Could not write to (/home/le/.local/share/apktool/framework), using /tmp instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
I: Loading resource table from file: /tmp/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...
[le@w530]: /tmp/apk>$ apktool b app
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
I: Using Apktool 2.4.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
S: WARNING: Could not write to (/home/le/.local/share/apktool/framework), using /tmp instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
W: /tmp/apk/app/AndroidManifest.xml:9: Tag <application> attribute name has invalid character 'p'.
W: /tmp/apk/app/AndroidManifest.xml:32: Tag <activity> attribute name has invalid character '@'.
W: /tmp/apk/app/AndroidManifest.xml:48: Tag <activity> attribute name has invalid character 'U'.
W: /tmp/apk/app/AndroidManifest.xml:49: Tag <activity> attribute name has invalid character ')'.
W: /tmp/apk/app/AndroidManifest.xml:50: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:51: Tag <activity> attribute name has invalid character ' '.
W: /tmp/apk/app/AndroidManifest.xml:52: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:53: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:54: Tag <activity> attribute name has invalid character '�'.
W: /tmp/apk/app/AndroidManifest.xml:63: Tag <provider> attribute name has invalid character ''.
W: /tmp/apk/app/AndroidManifest.xml:64: Tag <provider> attribute name has invalid character '@'.
W: /tmp/apk/app/AndroidManifest.xml:65: Tag <provider> attribute name has invalid character 'W'.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_1404317778591561696.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 27, --version-code, 4024404, --version-name, 4.24.4, --no-version-vectors, -F, /tmp/APKTOOL7608711109482947539.tmp, -0, arsc, -0, arsc, -I, /tmp/1.apk, -S, /tmp/apk/app/res, -M, /tmp/apk/app/AndroidManifest.xml]
i did an apktool roundtrip, excluding the resources. that worked fine. but I would like to inject java code instead of smali, thus would like to use dexpatcher. would probably save me some time ;)
please explain better. im away from computer. what do you mean by "excluding the resources"?
--no-res
exports only source, and no resources. with that, the roundtrip works fine.
[le@w530]: ~/src/dexpatcher-test>$ apktool --help
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Unrecognized option: --help
Apktool v2.4.0 - a tool for reengineering Android apk files
with smali v2.2.6 and baksmali v2.2.6
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>
usage: apktool
-advance,--advanced prints advance information.
-version,--version prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
-p,--frame-path <dir> Stores framework files into <dir>.
-t,--tag <tag> Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
-f,--force Force delete destination directory.
-o,--output <dir> The name of folder that gets written. Default is apk.out
-p,--frame-path <dir> Uses framework files located in <dir>.
-r,--no-res Do not decode resources.
-s,--no-src Do not decode sources.
-t,--frame-tag <tag> Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
-f,--force-all Skip changes detection and build all files.
-o,--output <dir> The name of apk that gets written. Default is dist/name.apk
-p,--frame-path <dir> Uses framework files located in <dir>.
For additional info, see: http://ibotpeaches.github.io/Apktool/
For smali/baksmali info, see: https://github.com/JesusFreke/smali
thanks. please report the problem to the apktool team. the dexpatcher gradle plugin does not have a solution to patch only code, but you can do it manually using dexpatcher-tool. also see that "patch-dex" sample. sorry i cant help you more.
What do you mean by dexpatcher-tool?
there is a repo called exactly that here.
cheers, thank you. I will have a look!
Hi, I started off with the 'patched-app' example. This was compiling fine for me. Then I swapped the APK and adjusted package names, etc. I am not really trying to change anything yet. I just want to re-compile the application.
I am getting the following error and I have no idea, what that means.