Skip to content

Instantly share code, notes, and snippets.

@denzuko
Forked from aldemirenes/android_build_run.sh
Last active March 2, 2020 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denzuko/2eee7d046f074317cbf5967c72b292a2 to your computer and use it in GitHub Desktop.
Save denzuko/2eee7d046f074317cbf5967c72b292a2 to your computer and use it in GitHub Desktop.
Shell scripts for Android development without needing to use Android Studio
PACKAGE_NAME := $(shell basename "$(shell pwd)")
APP_PID := $(shell adb shell ps | awk -F q=$(PACKAGE_NAME) '$0 ~ q { print $2 }')
APKFILE := app/build/outputs/apk/apk-debug.apk
.PHONY: all clean build logs install
all: build install logs
build:
@./gradlew assembleDebug
install:
@adb -d install -r $(APKFILE)
@adb shell monkey -p "$(PACKAGE_NAME)" -c android.intent.category.LAUNCHER 1
#@adb shell am start -n $(PACKAGE_NAME)/.MainActivity
clean:
@adb uninstall $(PACKAGE_NAME)
logs:
@adb logcat | grep $(APP_PID)
@denzuko
Copy link
Author

denzuko commented Mar 2, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment