0

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

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

我怎样才能做到这一点?

4

1 回答 1

2

以编程方式安装 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安装到模拟器的分步方法:

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 捕获屏幕截图。

于 2012-08-04T08:20:42.223 回答