Skip to content

Instantly share code, notes, and snippets.

@j796160836
Created February 18, 2016 01:52
Show Gist options
  • Select an option

  • Save j796160836/ec44ffe14329534b22af to your computer and use it in GitHub Desktop.

Select an option

Save j796160836/ec44ffe14329534b22af to your computer and use it in GitHub Desktop.
Extract wear micro app from handheld app ( apktool is needed. add apktool into $PATH variable or install apktool into /usr/local/bin/)
#!/bin/bash
if test $# -lt 1 ; then
echo "Usage: $0 <target-apk>"
exit 1
fi
FILE_NAME=$1
NEW_FILE_NAME=`echo $1 | sed 's/^\(.*\)\.\(.*\)$/\1/'`
TEMP_FOLDER=$NEW_FILE_NAME'_temp'
rm -R -f $TEMP_FOLDER
mkdir -p $TEMP_FOLDER
apktool -f d $FILE_NAME -o $TEMP_FOLDER
WEAR_APK_PATH=`ls $TEMP_FOLDER/res/raw/*.apk`
if [ ! -e $WEAR_APK_PATH ]; then
echo "File not found!: $WEAR_APK_PATH"
exit 1
fi
cp $WEAR_APK_PATH $NEW_FILE_NAME'_wearapk.apk'
rm -R -f $TEMP_FOLDER
echo ''
echo 'Done!'
echo ' Output: '$NEW_FILE_NAME'_wearapk.apk'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment