使用adb导出某个app

使用adb导出某个app

第一步查看app的包名

利用monitor监视要打开的app

1
2
3
PS D:\log> adb shell am monitor
##这时点击运行手机上要看包名的app,就可以看到启动的包名了
** Activity resuming: com.xxx.xxx

第二步 查看包存放路径

第一步可看到打开的app包名是com.xxx.xxx,接下来查看该包存放路径

1
2
PS D:\log> adb shell pm path com.xxx.xxx
package:/data/app/com.xxx.xxx-vgd98TTQzWZTy_qnmQMcIg==/base.apk

第三步 导出到电脑上

将包名 为com.xxx.xxx 的apk导出到电脑

1
PS D:\log> adb pull /data/app/com.xxx.xxx-vgd98TTQzWZTy_qnmQMcIg==/base.apk
安装apk提示Failure [INSTALL_FAILED_TEST_ONLY/ installPackageL

安装apk提示Failure [INSTALL_FAILED_TEST_ONLY/ installPackageL

Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

平台版本是android 7.0,在adb install *.apk 会提示下面的错误:

Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

方法1:

修改AndroidManifest.xml 中android:testOnly=”true” 改成 android:testOnly=”false”,或者直接去掉。

方法2:

adb push *.apk /tmp

adb shell pm install -t /tmp/*.apk

方法3:

adb install -t *.apk

方法4:

Android Studio 3.0 and FLAG_TEST_ONLY 一文中,给出了关于Android studio 3.0中出现问题的说明:
Option to indicate this application is only for testing purposes.
For example, it may expose functionality or data outside of itself that would cause a security hole, but is useful for testing.
This kind of application can not be installed without the INSTALL_ALLOW_TEST flag, which means only through adb install.

  1. You cannot install an app with android:testOnly=”true” by conventional means, such as from an Android file manager or from a download off of a Web site
  2. Android Studio 3.0 sets android:testOnly=”true” on APKs that are run from the IDE

解决办法:
在gradle.properties(项目根目录或者gradle全局配置目录 ~/.gradle/)文件中添加:
android.injected.testOnly=false

请转载的朋友表明出处:
http://blog.csdn.net/shift_wwx/article/details/78468397


:D 一言句子获取中...