Virus721 Virus721 - 1 year ago 115
Android Question

Android Studio - Only install APK

I am currently working on a "stand alone" service. I want this service to be accessible by any application that may want to use it. For that I have created an android project that only contains that service, without any Activity. I'm not sure whether this is the right way to acheive my goal, but I'm unfamiliar with Android.

My problem is, how do I only deploy the .apk to the (physical) device ? In order to start the service, i'm using

adb shell
and then
am startservice ...
, but I first need to install that service on the device. How do I do that ? The only options I see are meant to run/debug the application (and thus automatically deploy it), but I can't do that since it's a service. Thank you.

Answer Source

Open terminal in project's root folder and type:

gradlew.bat installDebug

for Windows or:

./gradlew installDebug

for Linux

You can do it with UI, just click the "Gradle" tab on the right, find "installDebug" in tasks and click it twice.

enter image description here

After that it will be default action performed on Shift+F10 (or clicking "Run" button).

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download