2

I have a bunch of DEX files but were not extracted from an APK by myself so I do not have the manifest, drawables, plus the rest of the resources/etc that are typically wrapped inside an APK. Is it possible to execute these in Android? I have tried dalvikvm to run the .dex itself as well as the .dex contained inside a .jar. I have also found what I believe to be the main activity to call but still no luck. Is this even possible?

  • While the answers below may be appropriate in a certain context, but yes it is still possible to load a dex file with a dex class loader and use the classes in it, as long as it is made for that purpose (i.e. a dex file that you created yourself to be used as such). –  May 26 '21 at 13:23

3 Answers3

0

It is not possible to run an Android application like that. It must be packaged into an apk with an AndroidManifest.xml, etc.

Using dalvikvm with a dex/jar from the terminal like what you describe only works for a public void main(String[] args) style command-line java application.

JesusFreke
  • 19,784
  • 5
  • 65
  • 68
  • Thank you! I spent a lot of time trying to get it to work and was starting to think that it's just not possible. – user3516511 Apr 09 '14 at 18:50
  • Maybe this needs a new question.. would it be theoretically possible to build a manifest based on the information in a classes.dex, enough so that a functioning apk could be built and executed? – user3516511 Apr 09 '14 at 18:51
  • 1
    For most apps, the bulk of the application's UI is defined in XML. None of that is baked into the classes.dex. – fadden Apr 09 '14 at 19:05
0

You can run only a jar(contains a classes.dex) or a dex file in the command line mode. dalvikvm works like the java in the command line.

Here is an Example: How to execute the dex file in android with command?

Community
  • 1
  • 1
QJGui
  • 907
  • 8
  • 10
-1

Nope is not possible...just go through how it is done!!

enter image description here

For more details check out: http://www.alittlemadness.com/2010/06/07/understanding-the-android-build-process/

nabeel
  • 1,181
  • 2
  • 10
  • 24