Android command line launches "Unknown" APK

Source: Internet
Author: User

Scene:

What if we don't have an available launcher on the phone or on the development page to display the APK, and we want to start it?


Way

At this point you need to start from the command line, and use the AM command from the command line to start need to know the corresponding APK specific package name and the main activity name, how do you know?

Use AAPT dump badging *.apk to see the program name, package name, and SDK used for this apk file. Example:

AAPT dump badging helloworld.apkpackage:name= ' <span style= "color: #ff0000;" >com.example.helloworld</span> ' versioncode= ' 1 ' versionname= ' 1.0 ' sdkversion: ' + ' targetsdkversion: ' ' Uses-permission: ' Android.permission.WRITE_EXTERNAL_STORAGE ' uses-permission: ' Android.permission.READ_ External_storage ' Application-label: ' HelloWorld ' application-icon-160: ' Res/drawable-mdpi/ic_launcher.png ' application-icon-240: ' res/drawable-hdpi/ic_launcher.png ' application-icon-320: ' Res/drawable-xhdpi/ic_ Launcher.png ' application-icon-480: ' res/drawable-xxhdpi/ic_launcher.png ' application:label= ' HelloWorld ' icon= ' res /drawable-mdpi/ic_launcher.png ' application-debuggablelaunchable-activity:name= ' <span style= "color: #ff0000;" >com.example.helloworld.MainActivity</span> ' label= ' HelloWorld ' icon= ' uses-feature: ' Android.hardware.touchscreen ' uses-implied-feature: ' Android.hardware.touchscreen ', ' assumed you require a touch screen unless explicitly made optional ' mainsupports-screens: ' small ' normal ' LARge ' XLarge ' supports-any-density: ' true ' locales: '--_--' densities: ' 160 ' 240 ' 320 ' 480 ' 



The red content is the package name and the main Page class name, combined with the AM command to start the corresponding program.

For example, adb shell am start-n com.example.helloworld/. Mainactivity

Specific am instructions can refer to the

http://blog.csdn.net/tiantianshangcha/article/details/41445775


Android command line launches "Unknown" APK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.