Skip to content

Instantly share code, notes, and snippets.

@takumakei
Last active December 18, 2015 21:29
Show Gist options
  • Save takumakei/5848173 to your computer and use it in GitHub Desktop.
Save takumakei/5848173 to your computer and use it in GitHub Desktop.
start an application by adb. the package name and activity name are read from AndroidManifest.xml.
COCOS_JAVA=../../../cocos/2d/platform/android/java
all: build install start
build: native java
native:
./build_native.py
java: ${COCOS_JAVA}/local.properties local.properties
ant debug
${COCOS_JAVA}/local.properties:
android update project -p ${COCOS_JAVA}
local.properties:
android update project -p .
install:
ant installd
start:
adb shell am start -a android.intent.aciton.MAIN -n $(shell xmlstarlet sel -t -v manifest/@package < AndroidManifest.xml)/$(shell xmlstarlet sel -t -v manifest/application/activity/@android:name < AndroidManifest.xml)
clean:
ant clean
./build_native.py clean
-rm -f ${COCOS_JAVA}/local.properties local.properties
COCOS_JAVA=../libs/cocos2dx/platform/android/java
all: build install start
build: native java
native:
./build_native.sh
java: ${COCOS_JAVA}/local.properties local.properties
ant debug
${COCOS_JAVA}/local.properties:
android update project -p ${COCOS_JAVA}
local.properties:
android update project -p .
install:
ant installd
start:
adb shell am start -a android.intent.aciton.MAIN -n $(shell xmlstarlet sel -t -v manifest/@package < AndroidManifest.xml)/$(shell xmlstarlet sel -t -v manifest/application/activity/@android:name < AndroidManifest.xml)
clean:
ant clean
./build_native.sh clean
-rm -f ${COCOS_JAVA}/local.properties local.properties
#!/bin/sh
MANIFEST=AndroidManifest.xml
if [ "x" = "x$(which xmlstarlet)" ]; then
echo "error: xmlstarlet not found."
echo " install it by 'brew install xmlstarlet'"
exit 1
fi
if [ ! -f $MANIFEST ]; then
echo error: $MANIFEST not found
exit 1
fi
PACKAGE_NAME=$(xmlstarlet sel -t -v manifest/@package < $MANIFEST)
ACTIVITY_NAME=$(xmlstarlet sel -t -v manifest/application/activity/@android:name < $MANIFEST)
adb shell am start -a android.intent.action.MAIN -n $PACKAGE_NAME/$ACTIVITY_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment