Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread: "Invalid magic value" #35

Open
pabloportugues opened this issue Nov 20, 2016 · 4 comments
Open

Exception in thread: "Invalid magic value" #35

pabloportugues opened this issue Nov 20, 2016 · 4 comments

Comments

@pabloportugues
Copy link

pabloportugues commented Nov 20, 2016

When running needle on a rooted phone, I get the following exception:

*** Selected device 569e42f8
 *** Device detected! proceeding...
 *** Working dir: /var/folders/x2/3tcjr3p12cj5_y9v2k69smpm0000gn/T/tmpdtp8jbt3
 *** Rooting adbd...
adbd is already running as root
remount succeeded
 *** Pulling framework from device...
 *** Disassembling framework...
Exception in thread "main" org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Invalid magic value: 64 65 78 0a 30 33 37 00
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.verifyMagicAndByteOrder(DexBackedDexFile.java:151)
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:70)
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:96)
	at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:109)
	at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:81)
	at org.jf.baksmali.main.main(main.java:259)
Traceback (most recent call last):
  File "patch.py", line 67, in <module>
    subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "baksmali.jar"), "framework.jar", "-o", "classes", "-ls"])
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/Users/User/Desktop/Needle-master/tools/baksmali.jar', 'framework.jar', '-o', 'classes', '-ls']' returned non-zero exit status 1

Thanks!

@Lanchon
Copy link

Lanchon commented Dec 1, 2016

this happens on Android 7 because the version of smali bundled with this project is old.

wrorkaround: both Haystack and Tingle work with Android 7.

https://github.com/Lanchon/haystack
https://github.com/ale5000-git/tingle

@ale5000-git
Copy link
Contributor

ale5000-git commented Dec 1, 2016

@Lanchon: Needle use a version of smali with multi-dex support (not the standard smali) but it is possible that it has some problems.

@Lanchon
Copy link

Lanchon commented Dec 2, 2016

magic 64 65 78 0a 30 33 37 00 is dex format 037 of android nougat.

it was added to smali on April 1:
JesusFreke/smali@40bbf5c#diff-8cbb11c3776eaef313d2db50d55a286cR52

currently has this form:
https://github.com/JesusFreke/smali/blob/master/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/HeaderItem.java#L46

don't know about mods it may have, but the smali base is old. that's why this error happens.

@ale5000-git
Copy link
Contributor

In fact I have choosen to use the official smali to receive updates earlier, each layer add additional time before updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants