Command line tool commands
You can choose not to enter the following commands, and the result of executing these commands is the same as clicking the Run button in Android Studio.
chmod +x gradlew-This command runs only once, and it is used to provide Gradlew the correct execution permissions.
./gradlew assembleDebug-This command compiles the code. (An APK package will be generated at app/build/apk)
adb install -r app/build/outputs/apk/app-debug-unaligned.apk-This command is used to install APK. -rthe flag flag has the effect of overwriting any previously installed version. Note If you have more than one device, you need to add a -s flag (immediately behind ADB) to specify the serial number of the target device.
adb shell am start -n com.example.android.sunshine.app/com.example.android.sunshine.app.MainActivity-This command is used to actually run the app.
If you are faithful to using command-line tools, check out the links below to learn more about how to use Android Debug Bridge (ADB) and compile with Gradle.
Professional tip: You can select multiple devices from the device picker!
Command line tools command-run package to phone