adb 安装软件,求教,不使用 pm install。

2021-02-08 17:35:58 +08:00
 gaoshiba
 adb shell am start -a android.intent.action.VIEW -t "application/vnd.android.package-archive"

下面的代码有办法用 adb 执行吗?

 Intent intent = new Intent(); 
 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
 //Action 
 intent.setAction(Intent.ACTION_VIEW); 
 //data 和 MIME Type
 intent.setDataAndType(Uri.fromFile("/sdcard/a.apk"), "application/vnd.android.package-archive"); 
 //startActivity
 startActivity(intent);  
1112 次点击
所在节点    程序员
1 条回复
gaoshiba
2021-02-08 17:44:05 +08:00
md,每次搞半天不会,提个问立马就搞出来。。

adb shell am start -a android.intent.action.VIEW -t "application/vnd.android.package-archive" -d "cont
ent://xxxxxxxxxxxxxxxxx"

这样就行了。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/752411

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX