Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在没有用户交互的情况下通过 android 代码在设备上安装/卸载应用程序?
是的,有可能您需要在语法上使用ProcessandRuntime来执行adbAndroid 中的命令。假设您想安装一个 apk,那么您需要运行。./adb install ~/Desktop/apkname同样,您需要为此使用./adb install命令。
Process
Runtime
adb
./adb install ~/Desktop/apkname
./adb install
Process process=Runtime.getRuntime().exec("./adb install 'complete path of your apk file'");
希望这会奏效祝你好运。