V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
gaoshiba
V2EX  ›  程序员

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

  •  
  •   gaoshiba · 2021-02-08 17:35:58 +08:00 · 1101 次点击
    这是一个创建于 1165 天前的主题,其中的信息可能已经有所发展或是发生改变。
     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);  
    
    1 条回复    2021-02-08 17:44:05 +08:00
    gaoshiba
        1
    gaoshiba  
    OP
       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"

    这样就行了。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4980 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 05:39 · PVG 13:39 · LAX 22:39 · JFK 01:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.