How to start an Android application from the command line?
adb shell
am start -n com.package.name/com.package.name.ActivityName
Or you can use this directly:
adb shell am start -n com.package.name/com.package.name.ActivityName
You can also specify actions to be filter by your intent-filters:
am start -a com.example.ACTION_NAME -n com.package.name/com.package.name.ActivityName
How to start an application using Android ADB tools
adb shell
am start -n com.package.name/com.package.name.ActivityName
Or you can use this directly:
adb shell am start -n com.package.name/com.package.name.ActivityName
You can also specify actions to be filter by your intent-filters:
am start -a com.example.ACTION_NAME -n com.package.name/com.package.name.ActivityName
How to execute android application in command line of Android Studio?
Update:
New location in Android Studio: View
-> Tool Windows
-> Terminal
.
Also, the default keyboard shortcut is alt + F12
.
Old:
Go to Tools
-> Open Terminal
. Works great.
Open and interact with android application from command line
You can use AndroidViewClient/culebra to create a script that does all you want. culebra --gui
can also be used to create the script just pointing and clicking on the UI (check https://github.com/dtmilano/AndroidViewClient/wiki/Culebra-GUI).
How to Launch Android Gradle App using command line on emulator and physical device. Not just build
Build Using Command-Line ->
For building our app using the command line you can use -
gradlew assembleDebug (For debug app)
For install apk on the connected device -
gradlew installDebug
For more info, you can check -
https://developer.android.com/studio/build/building-cmdline
How do I launch the Android emulator from the command line?
I assume that you have built your project and just need to launch it, but you don't have any AVDs created and have to use command line for all the actions. You have to do the following.
- Create a new virtual device (AVD) for the platform you need. If you have to use command line for creating your AVD, you can call
android create avd -n <name> -t <targetID>
where targetID is the API level you need. If you can use GUI, just type inandroid avd
and it will launch the manager, where you can do the same. You can read more about AVD management through GUI and through command line. - Run the AVD either by using command
emulator -avd <name>
or through previously launched GUI. Wait until the emulator fully loads, it takes some time. You can read about additional options here. - Now you have to install the application to your AVD. Usually during development you just use the same Ant script you used to build the project, just select
install
target. However, you can install the application manually using commandadb install <path-to-your-APK>
. - Now switch to emulator and launch your application like on any normal device, through the launcher. Or, as an alternative, you can use the following command:
adb shell am start -a android.intent.action.MAIN -n <package>/<activity class>
. For example:adb shell am start -a android.intent.action.MAIN -n org.sample.helloworld/org.sample.helloworld.HelloWorld
. As a commenter suggested, you can also replaceorg.sample.helloworld.HelloWorld
in the line above with just.HelloWorld
, and it will work too.
Related Topics
Access Pictures from Pictures App in My Android App
Fileprovider Crash - Npe Attempting to Invoke Xmlresourceparser on a Null String
Android Logcat Logs Chatty Module Line Expire Message
Android Gridview Draw Dividers
Can't Upgrade Android Sdk Tools
Android Studio 3.1 Cannot Resolve Symbol (Themes, Widget, Attr, etc.)
How to Disable Future Dates in Android Date Picker
Android: 2 or More Expandablelistview Inside Navigation Drawer
Using Tesseract for Handwriting Recognition
Android Runtime Layout Tutorial
How to Replace Deprecated Android.Support.V4.App.Actionbardrawertoggle
How to Dynamically Set Headers in Retrofit (Android)
Parcelable Encountered Ioexception Writing Serializable Object Getactivity()
How to Make an Fm Radio Application in Android
Android: Making a Fullscreen Application