Created
September 14, 2018 05:30
-
-
Save nvlled/1039dabe8fab4e1a91f21b12c23a107b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Gets the main activty of the android project | |
# Run at project root folder | |
# output like: com.package.sub/com.package.sub.MainActivity | |
# Purpose: use with android am for running the installed apk | |
activity=$(cat `find app/src -iname "AndroidManifest.xml"` | grep -i '<activity android:name' | sed 's/.*="\(.*\)".*/\1/') | |
activity=$(echo $activity | sed 's/^\.//') | |
dir=$(dirname `find app/src -name "$activity.*"`) | |
dir=$(echo $dir | sed 's@app/src/main/java/@@') | |
package=$(echo $dir | sed 's@/@.@g') | |
echo $package/$package.$activity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment