How to run an android application using .apk file?

Here is the example how to run apk when you do not know what is the apk’s name.

First you need to call aapt to get info about AndroidManifest.xml from interesting apk. I will show you example on WifiKillDOwnloader.apk
In console you call:

aapt d xmltree WiFiKillDownloader.apk AndroidManifest.xml > manifest.txt

Console will output this:

N: android=
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x7
A: android:versionName(0x0101021c)="1.7" (Raw: "1.7")
A: package="me.paranoid.wifikilld" (Raw: "me.paranoid.wifikilld")
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0xe
E: uses-permission (line=8)
A: android:name(0x01010003)="android.permission.WRITE_EXTERNAL_STORAGE" (Raw: "android.permission.WRITE_EXTERNAL_STORAGE")
E: uses-permission (line=9)
A: android:name(0x01010003)="android.permission.GET_ACCOUNTS" (Raw: "android.permission.GET_ACCOUNTS")
E: uses-permission (line=10)
A: android:name(0x01010003)="android.permission.VIBRATE" (Raw: "android.permission.VIBRATE")
E: uses-permission (line=11)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=13)
A: android:label(0x01010001)=@0x7f040000
A: android:icon(0x01010002)=@0x7f020005
E: activity (line=16)
A: android:theme(0x01010000)=@0x103006b
A: android:label(0x01010001)=@0x7f040000
A: android:name(0x01010003)=".WiFiKillDActivity" (Raw: ".WiFiKillDActivity")
E: intent-filter (line=20)
E: action (line=21)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=23)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")

OK, now you must find values for apk package=”XXX” and android:name to use in this scheme:

adb shell am start -a android.intent.action.MAIN -n <package>/<name>

When we get it, we call in this way:

adb shell am start -a android.intent.action.MAIN -n me.paranoid.wifikilld/.WiFiKillDActivity

I don’t have apt, where can I get it? You should find it in $ANDROID_SDK/build-tools/

Leave a Reply

Your email address will not be published. Required fields are marked *