Needle
Needle copied to clipboard
Unable to patch Android 5.1 (Fairphone 2)
Was working (multiple times) before the bunch of recent updates, :confused: Seems to be related with the new version/use of Apktool, from my point of view.
Log:
$ ./patch.py
*** Selected device xXXXxXxX
*** Device detected! proceeding...
*** Working dir: /tmp/tmpfkuhbdx0
*** Rooting adbd...
adbd is already running as root
remount succeeded
*** Pulling framework from device...
5857 KB/s (5426893 bytes in 0.904s)
*** Disassembling framework...
*** Done. Now this won't hurt a bit...
*** Injection successful. Reassembling smali...
output:classes.dex
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65536
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:315)
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1025)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:801)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:250)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:228)
at org.jf.smali.main.main(main.java:293)
Traceback (most recent call last):
File "./patch.py", line 140, in <module>
subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "smali.jar"), "classes", "-o", "classes.dex"])
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/home/ubuntu-gnome/Documentos/android/Needle/tools/smali.jar', 'classes', '-o', 'classes.dex']' returned non-zero exit status 2
(Note that I've replaced device id with exes: xXXXxXxX
)
Host (Ubuntu Gnome):
$ lsb_release -d
Description: Ubuntu 16.04.1 LTS
$ python --version`
Python 3.5.2
$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
(Just in case: Fairphone Open OS is based on CodeAurora sources. Sources for the OS are available at http://code.fairphone.com/)
Works without troubles in the 19913c8 revision.
Log:
$ git checkout 19913c8
HEAD is now at 19913c8... Update README.md
$ ./patch.py
*** Selected device xXXXxXxX
*** Device detected! proceeding...
*** Working dir: /tmp/tmps_9lfw53
*** Rooting adbd...
adbd is already running as root
remount succeeded
*** Pulling framework from device...
3551 KB/s (5426893 bytes in 1.492s)
*** Disassembling framework...
I: Using Apktool 2.0.2 on framework.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
*** Done. Now this won't hurt a bit...
*** Injection successful. Reassembling smali...
I: Using Apktool 2.0.2
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
W: Could not find resources
I: Building apk file...
*** Putting things back like nothing ever happened...
updating: classes.dex (deflated 60%)
*** Pushing changes to device...
5922 KB/s (5459325 bytes in 0.900s)
*** All done! :)
(Note that I've replaced device id with exes: xXXXxXxX
)
I have a workaround for this problem in Tingle, could you please test if it is working?
I did a backup of my OS and reinstalled clean FP Open OS:
$ python3 main.py
MENU
1 - Patch file from a device (adb)
2 - Patch file from the input folder
> 1
ERROR: Missing executable => 7za
ERROR CODE: 67
What should I install? I installed the p7zip
package and error still appear.
On Linux it need p7zip-full (not p7zip).
UNEXPECTED TOP-LEVEL EXCEPTION: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65536 at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116) at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:315) at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1025) at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:801) at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:250) at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:228) at org.jf.smali.main.main(main.java:293)
this means that the resulting dex file is too big and it has to be written using multidex.
@Lanchon: My workaround just move some methods from one dex to the last dex and reassemble.
Sorry, @ale5000-git, I haven't had the time to try Tingle yet. FP2 is my daily phone and I must take care of its data before tinkering with it, so I need some spare time. Maybe tomorrow night or friday's.
Do not worry there isn't any time limit :)
It seems to be working great! Oli.sax, from the Fairphone Community, tested it on his FP2. Relevant link: https://forum.fairphone.com/t/how-to-be-able-to-install-and-use-any-app-on-fp-open-os-experimental/22327/20?u=roboe
Good, thanks :) I don't know Fairphone too much but I have heard there are more than one type with different versions on Android (one with KitKat and one with an older version).
I would like to know, if possible, when you have time, if it works on both versions. Tingle in theory should work correctly also on old versions of Android but I cannot test it.
There are two Fairphone devices:
- The original Fairphone (2003), also called FP1, which runs Android 4.2 (but an official 4.4 is in the making, although it is not being sold anymore)
- The modular Fairphone 2 (late 2015), also called FP2, which runs Android 5.1. Two Androis flavours (OSes) are provided:
- the FP OS (GMS) one, the default and with Google Mobile Services;
- and FP Open OS, without Google Mobile Services.
I only own a FP2, running FP Open OS (just like Oli.sax's one), thus I can't try Tingle on the FP1… :(
Hey, just tried tingle
with the new FP Open OS update (16.10.0) and, just like Oli.sax said, it worked like a charm!
Thank you, :)
Good, thanks for the test :)