• ADB command


    1. show all app
    $ adb shell pm list packages -f

    2. install
    adb install *.apk
    adb install -r *.apk

    3.show all package
    adb shell pm list packages

    4. find apk path
    adb shell pm path com.example.someapp
    like this: package:/data/app/com.example.someapp-2.apk

    5. copy apk from phone
    adb pull /data/app/com.example.someapp-2.apk
    apk target path is cmd current path

    6. view sign
    jarsigner -verify app_signed.apk
    jarsigner -verify -verbose -certs app_signed.apk
    http://blog.csdn.net/tangmin0719/article/details/8916417

    Refer:http://developer.android.com/tools/help/adb.html 

    CategoryCommandDescriptionComments
    Target Device -d Direct an adb command to the only attached USB device. Returns an error if more than one USB device is attached.
    -e Direct an adb command to the only running emulator instance. Returns an error if more than one emulator instance is running.
    -s <serialNumber> Direct an adb command a specific emulator/device instance, referred to by its adb-assigned serial number (such as "emulator-5556"). See Directing Commands to a Specific Emulator/Device Instance.
    General devices Prints a list of all attached emulator/device instances. See Querying for Emulator/Device Instances for more information.
    help Prints a list of supported adb commands.  
    version Prints the adb version number.  
    Debug logcat [option] [filter-specs] Prints log data to the screen.  
    bugreport Prints dumpsysdumpstate, and logcat data to the screen, for the purposes of bug reporting.  
    jdwp Prints a list of available JDWP processes on a given device. You can use the forward jdwp:<pid> port-forwarding specification to connect to a specific JDWP process. For example: 
    adb forward tcp:8000 jdwp:472
    jdb -attach localhost:8000
    Data install <path-to-apk> Pushes an Android application (specified as a full path to an .apk file) to an emulator/device.  
    pull <remote> <local> Copies a specified file from an emulator/device instance to your development computer.  
    push <local> <remote> Copies a specified file from your development computer to an emulator/device instance.  
    Ports and Networking forward <local> <remote> Forwards socket connections from a specified local port to a specified remote port on the emulator/device instance. Port specifications can use these schemes:
    • tcp:<portnum>
    • local:<UNIX domain socket name>
    • dev:<character device name>
    • jdwp:<pid>
    ppp <tty> [parm]... Run PPP over USB.
    • <tty> — the tty for PPP stream. For exampledev:/dev/omap_csmi_ttyl.
    • [parm]... — zero or more PPP/PPPD options, such asdefaultroutelocal,notty, etc.

    Note that you should not automatically start a PPP connection.

     
    Scripting get-serialno Prints the adb instance serial number string. See Querying for Emulator/Device Instances for more information.
    get-state Prints the adb state of an emulator/device instance.
    wait-for-device Blocks execution until the device is online — that is, until the instance state isdevice. You can prepend this command to other adb commands, in which case adb will wait until the emulator/device instance is connected before issuing the other commands. Here's an example:
    adb wait-for-device shell getprop
    Note that this command does not cause adb to wait until the entire system is fully booted. For that reason, you should not prepend it to other commands that require a fully booted system. As an example, theinstall requires the Android package manager, which is available only after the system is fully booted. A command such as
    adb wait-for-device install <app>.apk
    would issue the install command as soon as the emulator or device instance connected to the adb server, but before the Android system was fully booted, so it would result in an error.
    Server start-server Checks whether the adb server process is running and starts it, if not.  
    kill-server Terminates the adb server process.  
    Shell shell Starts a remote shell in the target emulator/device instance. See Issuing Shell Commands for more information.

    CommandDescription
    start [options] <INTENT> Start an Activity specified by <INTENT>.

    See the Specification for <INTENT> arguments.

    Options are:

    • -D: Enable debugging.
    • -W: Wait for launch to complete.
    • --start-profiler <FILE>: Start profiler and send results to <FILE>.
    • -P <FILE>: Like --start-profiler, but profiling stops when the app goes idle.
    • -R: Repeat the activity launch <COUNT> times. Prior to each repeat, the top activity will be finished.
    • -S: Force stop the target app before starting the activity.
    • --opengl-trace: Enable tracing of OpenGL functions.
    • --user <USER_ID> | current: Specify which user to run as; if not specified, then run as the current user.
    startservice [options] <INTENT> Start the Service specified by <INTENT>.

    See the Specification for <INTENT> arguments.

    Options are:

    • --user <USER_ID> | current: Specify which user to run as; if not specified, then run as the current user.
    force-stop <PACKAGE> Force stop everything associated with <PACKAGE> (the app's package name).
    kill [options] <PACKAGE> Kill all processes associated with <PACKAGE> (the app's package name). This command kills only processes that are safe to kill and that will not impact the user experience.

    Options are:

    • --user <USER_ID> | all | current: Specify user whose processes to kill; all users if not specified.
    kill-all Kill all background processes.
    broadcast [options] <INTENT> Issue a broadcast intent.

    See the Specification for <INTENT> arguments.

    Options are:

    • [--user <USER_ID> | all | current]: Specify which user to send to; if not specified then send to all users.
    instrument [options] <COMPONENT> Start monitoring with an Instrumentation instance. Typically the target<COMPONENT> is the form <TEST_PACKAGE>/<RUNNER_CLASS>.

    Options are:

    • -r: Print raw results (otherwise decode <REPORT_KEY_STREAMRESULT>). Use with [-e perf true] to generate raw output for performance measurements.
    • -e <NAME> <VALUE>: Set argument <NAME> to <VALUE>. For test runners a common form is -e <testrunner_flag> <value>[,<value>...].
    • -p <FILE>: Write profiling data to <FILE>.
    • -w: Wait for instrumentation to finish before returning. Required for test runners.
    • --no-window-animation: Turn off window animations while running.
    • --user <USER_ID> | current: Specify which user instrumentation runs in; current user if not specified.
    profile start <PROCESS> <FILE> Start profiler on <PROCESS>, write results to <FILE>.
    profile stop <PROCESS> Stop profiler on <PROCESS>.
    dumpheap [options] <PROCESS> <FILE> Dump the heap of <PROCESS>, write to <FILE>.

    Options are:

    • --user [<USER_ID>|current]: When supplying a process name, specify user of process to dump; uses current user if not specified.
    • -n: Dump native heap instead of managed heap.
    set-debug-app [options] <PACKAGE> Set application <PACKAGE> to debug.

    Options are:

    • -w: Wait for debugger when application starts.
    • --persistent: Retain this value.
    clear-debug-app Clear the package previous set for debugging with set-debug-app.
    monitor [options] Start monitoring for crashes or ANRs.

    Options are:

    • --gdb: Start gdbserv on the given port at crash/ANR.
    screen-compat [on|off] <PACKAGE> Control screen compatibility mode of <PACKAGE>.
    display-size [reset|<WxH>] Override emulator/device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa.

    Example:
    am display-size 1280x800

    display-density <dpi> Override emulator/device display density. This command is helpful for testing your app across different screen densities on high-density screen environment using a low density screen, and vice versa.

    Example:
    am display-density 480

    to-uri <INTENT> Print the given intent specification as a URI.

    See the Specification for <INTENT> arguments.

    to-intent-uri <INTENT> Print the given intent specification as an intent: URI.

    See the Specification for <INTENT> arguments.

  • 相关阅读:
    web-----------HTTP协议
    python基础作业------模拟实现一个ATM + 购物商城程序
    python--------进程与线程
    作业--用户输入数字0-100,判断成绩,用函数
    blog真正的首页
    blog首页视图
    让django完成翻译,迁移数据库模型
    创建Django博客的数据库模型
    创建blog APP
    在PyCharm上创建Django项目
  • 原文地址:https://www.cnblogs.com/xiaokang088/p/4108202.html
Copyright © 2020-2023  润新知