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

Error when Instrumenting an apk #33

Closed
francescolupo opened this issue Jul 15, 2023 · 3 comments
Closed

Error when Instrumenting an apk #33

francescolupo opened this issue Jul 15, 2023 · 3 comments

Comments

@francescolupo
Copy link

francescolupo commented Jul 15, 2023

Hello, I am a Macbook pro owner with an Apple Silicon processor. I have tried to test ACV with various apks
When I run the acv instrument <path> command, I get different but similar errors each time. For example:

acv instrument shazam-13-27-0-230420.apk

The working directory exists and may contain data: /Users/francesco/acvtool/acvtool_working_dir
Overwrite (y/n)? y
decompiled com.shazam.android
parsing /Users/francesco/acvtool/acvtool_working_dir/apktool/com.shazam.android/smali...
saving instrumented smali:  /Users/francesco/acvtool/acvtool_working_dir/apktool/com.shazam.android/smali...
pickle file saved: /Users/francesco/acvtool/acvtool_working_dir/metadata/shazam-13-27-0-230420.pickle
instrumented
Exception in thread "main" org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Ltool/acv/AcvReporter;->saveExternalPublicFile(Ljava/io/File;)V
	at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:917)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:341)
	at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:297)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:61)
	at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:36)
	at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:418)
	at brut.androlib.Androlib.buildSources(Androlib.java:349)
	at brut.androlib.Androlib.build(Androlib.java:301)
	at brut.androlib.Androlib.build(Androlib.java:268)
	at brut.apktool.Main.cmdBuild(Main.java:251)
	at brut.apktool.Main.main(Main.java:79)
Caused by: org.jf.util.ExceptionWithContext: Unsigned short value out of range: 69311
	at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
	at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1212)
	at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:913)
	... 10 more


built
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/py27/bin/acv", line 11, in <module>
    load_entry_point('acvtool', 'console_scripts', 'acv')()
  File "/Users/francesco/Desktop/acvtool/acvtool.py", line 217, in main
    run_actions(parser, args)
  File "/Users/francesco/Desktop/acvtool/acvtool.py", line 52, in run_actions
    mem_stats=args.memstats)
  File "/Users/francesco/Desktop/acvtool/smiler/instrumenting/utils.py", line 107, in wrapper
    result = method(*args, **kwargs)
  File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 186, in instrument_apk
    sign_align_apk(instrumented_package_path, instrumented_apk_path)
  File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 277, in sign_align_apk
    request_pipe(align_cmd)
  File "/Users/francesco/Desktop/acvtool/smiler/smiler.py", line 47, in request_pipe
    Out: %s\nError: %s" % (out, err))
Exception: ----------------------------------------------------
Out:
Error: Unable to open '/Users/francesco/acvtool/acvtool_working_dir/shazam-13-27-0-230420.apk' as zip archive

I would appreciate it if you could help me.

Thank you so much.

@pilgun
Copy link
Owner

pilgun commented Jul 15, 2023 via email

@francescolupo
Copy link
Author

Thank you for the answer.
Could you list me some apks with which I can test acvtool?

@pilgun
Copy link
Owner

pilgun commented Jul 26, 2023

Most of single dex apps should work well. Single DEX APKS are usually more less simple apps, you may find many o them on FDroid.

In this demo we used AIMP https://www.youtube.com/watch?v=xyaR4Ivrij0 (could still work)

Also you could try compile an APK yourself, for example this one https://github.com/pilgun/TimeBomb

To get the quick idea of reports please feel free to checkout these ones https://report.debloat.app/

@pilgun pilgun closed this as completed Apr 29, 2024
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

2 participants