3

Is it possible to run a .apk on an Android device without installing the app?

I can do something like this:
adb install com.your.app
and then:
adb shell am start -n com.your.app/com.your.app.MainActivity

This works but it installs the apk on the device and I don't want that. I want to run the apk on the device without installing the apk on the device. Is this possible?

  • You can install on emulator if you have problem with your device. – Vivek Ji Feb 22 '16 at 10:25
  • It may be possible by running the class directly with dalvikvm command. but i havent tried it android.googlesource.com/platform/external/smali/+/… – Dr Deo Apr 21 '16 at 16:11
  • for what reason do you want "no installing"? It could be automated to remove the app, so as to only temporarily have it installed briefly, is this what you are looking for? – humanityANDpeace May 1 '16 at 10:51
5

Running an APK without installing it?

No matter if you won't accept the answer, running an APK is not possible.

It's not an executable, it's an archive containing the application and instructions on where all it's resources should be placed so that the app can run.

Android APK File Format

Asking this question is the same as asking how you run an iso image, or how you run a zip, or rar file.

If you really don't want to install it, there's no way to 'run' it.

The only alternative is to install it in a sandbox environment or something like that.

You could try to extract the binary from the APK to the device, and using a shell to run it, but I'm NOT to be held responsible if the results are unwanted.

If you told us why you want to run, but not install it, then I might get you a better answer.

  • I need to achieve the same. I want to run apps the way Facebook Messanger runs the Instant Games. In my app, I have hundreds of plugins and each cannot be part of apk. So can I run those modules, if user wants. I have seen this done by Facebook messanger and Hike for games. – Chandra Sekhar May 24 '17 at 10:45
4

I am sorry but this is not possible.

During apk installation (even via adb), managed by the android Package Manager on the device, various processes are executed such as:

  • Determine the appropriate location of the package installation
  • Copying a copy of the apk file to a given directory (usually /data/app/)
  • Create the application directory and set permissions to store database and shared preference, native library (usually /data/data//)
  • Extraction of dex code to the cache directory

There is no way an apk can run on an android device if it's resources and configuration are not on the same device

protected by Community Mar 4 '16 at 18:20

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.