Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用ADB在PC的SD卡上安装apk进行测试并截图_Android_Adb_Monkeyrunner - Fatal编程技术网

Android 使用ADB在PC的SD卡上安装apk进行测试并截图

Android 使用ADB在PC的SD卡上安装apk进行测试并截图,android,adb,monkeyrunner,Android,Adb,Monkeyrunner,我第一次使用ADB或android调试桥 问题是我已经编写了一个代码,可以直接从市场上的设备上下载APK。现在我想运行ADB来安装下载的apk并截图 如何才能做到这一点?以编程方式安装apk文件 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/barcode.apk")

我第一次使用ADB或android调试桥

问题是我已经编写了一个代码,可以直接从市场上的设备上下载APK。现在我想运行ADB来安装下载的apk并截图


如何才能做到这一点?

以编程方式安装apk文件

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()  + "/barcode.apk")), "application/vnd.android.package-archive");
startActivity(intent);
*首先以编程方式将apk文件复制到sd卡,然后执行上述步骤*

将android apk安装到emulator的分步方法:

1) Install Android SDK
2) Start the emulator by going to $SDK_root/emulator.exe
3) Go to command prompt and go to the directory $SDK_root/platform-tools 
4) Type in the command adb install
5) Now ur app is up and running on the emulator

查看以通过ADB捕获屏幕截图。

我的apk在sdk卡中。因此,我在终端上发出命令,那么SD卡上的apk应该如何安装DB install D:/download/test.apk