How to view application package name package and entry activity name in Android development

When using the android automated testing tool monkeyrunner to start the application, you need to fill in the package name of the program under test and the activity to start. There are two methods to view the package name of the application package and the name of the entry activity:
Method 1: Use aapt //aapt comes with the sdk One of the tools, in the sdk\builds-tools\ directory
1. Take the ES file browser as an example, switch to the aapt.exe directory in the command line and execute: aapt dump badging E:\apk\es3.apk
2. After running The following two lines in the result are the application package name package and the entry activity name
package: name='com.estrongs.android.pop'
launchable-activity: name='com.estrongs.android.pop.view.FileExplorerActivity'
Note: in Search the android sdk directory to find aapt.exe, if not, you can download apktool.

Method 2: View AndroidManifest.xml
1. Use apktool to decompile the app: apktool.bat d es3.apk E:\apk\es
2. Open the package attribute value of AndroidManifest.xml
manifest node is the package name of the application: <manifest package= "com.estrongs.android.pop">
Find the activity corresponding to android.intent.action.MAIN and android.intent.category.LAUNCHER. The android:name attribute corresponding to the activity is both the entry activity name, as follows:
<activity android:theme=”@*android tyle/Theme.NoTitleBar ” android:label=”@string/app_name” android:name=”com.estrongs.android.pop.view.FileExplorerActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” / >
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
android.intent.action.MAIN determines the Activity that the application starts first

android.intent.category.LAUNCHER Determines whether the application is displayed in the program list

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326820783&siteId=291194637