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

dexlib2 cannot open dex file extracted from framework.jar (/system/framework/framework.jar) #886

Open
localacct opened this issue Jun 26, 2024 · 0 comments

Comments

@localacct
Copy link

Hi

I tried to use dexlib2 to open a dex file (classes.dex) that I unzipped and extracted from framework.jar but I encountered an error

06-26 20:08:43.697  6094  6094 V log_files: error org.jf.util.ExceptionWithContext: /storage/emulated/0/Android/data/<package.name.redacted>/files/classes.dex is not an apk, dex file or odex file.
06-26 20:08:43.697  6094  6094 V log_files: 	at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:111)
06-26 20:08:43.697  6094  6094 V log_files: 	at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:54)
06-26 20:08:43.697  6094  6094 V log_files: 	at <package.name.redacted>.MainActivity.onCreate(MainActivity.kt:188)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.Activity.performCreate(Activity.java:8595)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.Activity.performCreate(Activity.java:8573)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.os.Handler.dispatchMessage(Handler.java:106)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.os.Looper.loopOnce(Looper.java:205)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.os.Looper.loop(Looper.java:294)
06-26 20:08:43.697  6094  6094 V log_files: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
06-26 20:08:43.697  6094  6094 V log_files: 	at java.lang.reflect.Method.invoke(Native Method)
06-26 20:08:43.697  6094  6094 V log_files: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
06-26 20:08:43.697  6094  6094 V log_files: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

I checked with the file command and confirm that classes.dex is a dex file.

file classes.dex
classes.dex: Android dex file, version 039

I am running the application on Android emulator OS version 14.

The code snippet is taken from https://stackoverflow.com/questions/11343388/is-there-a-way-to-get-a-list-of-all-classes-from-a-dex-file

val dexFile = DexFileFactory.loadDexFile(File("/storage/emulated/0/Android/data/<package.name.redacted>/files/classes.dex"), 29 /*api level*/)

References
https://stackoverflow.com/questions/11343388/is-there-a-way-to-get-a-list-of-all-classes-from-a-dex-file

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

1 participant