APK Installation and removal

Source: Internet
Author: User

1, Signature:

Java-jar Signapk.jar Platform.x509.pem platform.pk8 downloadprovider.apk downloadprovider-sign.apk

2,

ADB Connect 192.168.12.103

ADB remount

3,APK installation (You can place the directory directly with ADB push, or with adb install):

ADB push Downloadprovider.apk/data/app

ADB install-f xxx.apk

ADB uninstall APK package name or delete rm directly

4. Start activity:

[Email protected]:/# am start-n com.mozillaonline.downloadprovider/. Downloadprovideractivity

This is with the package name/. Class Name

<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"

Package= "Com.mozillaonline.downloadprovider"

。。。。。

<activity
Android:name= ". Downloadprovideractivity "

Reference:

usage of adb shell amUse this command to start activity, services, send broadcast, etc. from the cmd console:C:\USERS\ADMINISTRATOR&GT;ADB Shell AM
usage:am [subcommand] [options]

Start an activity:am start [-d] [-W] <INTENT>
-d:enable debugging
-w:wait for launch to complete

Start a service:am startservice <INTENT>

Send a broadcast intent:am broadcast <INTENT>

Start an INSTRUMENTATION:AM instrument [flags] <COMPONENT>
-r:print Raw Results (otherwise decode Report_key_streamresult)
-e <NAME> <value>: set argument <NAME> to <VALUE>
-P <file>: Write profiling data to <FILE>
-w:wait for instrumentation to finish before returning

Start Profiling:am profile <PROCESS> start <FILE>
Stop Profiling:am profile <PROCESS> stop

Start Monitoring:am Monitor [--gdb <port>]
--gdb:start Gdbserv on the given port at Crash/anr

<INTENT> specifications include these flags:
[-a <action>] [-D ] [-t <mime_type>]
[-C <CATEGORY> [-C <category>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <component>] [-f <flags>]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--debug-log-resolution]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top]
[--receiver-registered-only] [--receiver-replace-pending]
[<uri>] Use instances: such as starting an Activity: format: ADB shell am START-N package Name/package name + class name (-N class name,-a action,-d date,-m mime-type,-c category,-e Extended data, etc.). Instance 1:c:\users\administrator>adb shell am start-n com.android.camera/. Camera
starting:intent {cmp=com.android.camera/. Camera}
Example 2: (Intent with extra) c:\users\administrator>adb shell am start-n com.android.camera/. CAMERA-E ThisKey Thisisvalue
starting:intent {cmp=com.android.camera/. Camera (has extras)} where extra's key is ABC, value is the string "Hello" and can also send commands to simulate the mobile low-power environment:

Instance:

ADB shell am broadcast-a android.intent.action.BATTERY_CHANGED--ei "level" 3--ei "scale" 100

Differences in the use of ADB push and adb install in Android Dreamtale2014-03-10 23:41:44This article is submitted by Yingchun Shi (@ three vulgar little Women). Reprint please specify the original address.
In the actual development of Android, the ADB command is often used, and the installation application can use ADB push or adb install. Here are the differences between the two ways of installation.

ADB push enables you to specify the installation directory. For example, after implementing "ADB push xxx.apk System/app", xxx.apk is installed in the System/app directory, the software under this directory is the system application mentioned above. (Note that the System/app is read-only, so only the root permission can be used to push the apk in, and the APK will overwrite the original APK when it is push in.) The ADB push itself means copying the file to a folder in the system, but it will register the app after the APK is push to System/app and the phone is restarted.
ADB install the software installed with this command is located in the Data/app directory, with the parameter-R to force the installation, user application.

As indicated by the above two, the main differences between the ADB install and the ADB push apk are:




Push
Install


Directory
System/app
Data/app


Permissions
System level (full access)
User level (not fully open)


Unloading
Delete after root
Can be uninstalled


Size
Unlimited, custom
There are restrictions


Installation
PM re-registration
No re-registration



Manually installed APK version number is the same as the system built-in API version number.

A deeper layer of analysis:
1, Android System Application update mechanism

The system provides Versionname, Versioncode two properties for each application in Androidmainfest.xml.

The versionname:string type, which is used to view the version for the app's users.
The Versioncode:integer type, as the basis for the system to determine whether the application can be upgraded.



2, Android system built-in application update judgment code

Code from Package update criteria for Scanpackageli functions in Frameworks/base/services/java/com/android/server/packagemanagerservice.java

From the above data analysis:

The same AP, if there is a higher version of the app under Data/app, but the older version under System, follow the old version.
It is also known that if more than two APs are in the same process but only one AP has changed API version, the compilation will fail
Suppose there are two ap:ap1 and AP2. Two APs are both build through and install into the phone after the API version update. And the system has built-in AP1 is the old version, the reboot will still register the old version of the AP1. At this point, the same process will appear in the system but different versions of AP1 (System/app) and AP2 (Data/app)

In summary, compilation will go wrong.
Guess:

If the APS of the same process are compiled with the same version of the SDK, push into the phone, it can be run (verified).
If the APS of the same process are compiled with the same version of the SDK. Install into the phone, you can run it, if you delete all the same process APS within the System/app. (verified)
If the AP of the same process is compiled with the same version of the SDK, the Push/install can be (to be verified).


Author Introduction:
Yingchun Shi, a female programmer, focuses on the framework layer of the Android system, currently serving on HTC.

Original link: http://www.grackertalk.com/?p=48

APK Installation and removal

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.