public  void RunCmd(String mycmd)
{ Process su = null;
try {
su = Runtime.getRuntime().exec("su");
} catch (IOException e) {
e.printStackTrace();
}
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream()); try {
outputStream.writeBytes(mycmd+"\n");
outputStream.flush(); outputStream.writeBytes("exit\n");
outputStream.flush();
try {
su.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
} } catch (IOException e) {
e.printStackTrace();
} }

  

Android Studio 运行shell的更多相关文章

  1. 【转】实践最有效的提高Android Studio运行、编译速度方案

    原文:https://blog.csdn.net/xwh_1230/article/details/60961723 实践最有效的提高Android Studio运行.编译速度方案 最有效提升Andr ...

  2. 【转】MIUI8以及ViVO X9上在Android Studio运行出错集及其解决方案

    最近用一台红米4高配版(6.0)以及ViVo X9(7.1)来做测试机,它是小米MIUI系统的最新版本MIUI8,我的AS是2.3版本,在网上查看了相关问题,在小米5和红米note4x等配备了MIUI ...

  3. Android studio 运行模拟器报:Application Installation Failed

    前两天笔记本加了个SSD硬盘,原机械硬盘移植到光驱位,硬盘盘符都变了,结果在用android studio 运行以前的程序编译不报错,运行模拟器就会报如下错误. Installation failed ...

  4. 第一次通过AVD Manager创建了一个虚拟设备,但是在Android Studio运行程序时却无设备可选

    第一次通过AVD Manager创建了一个虚拟设备,但是在Android Studio运行程序时却无设备可选 原因是adb.exe未运行起来 至于adb.exe未正常运行起来的原因多半是5037端口被 ...

  5. 解决Android Studio运行时报Error:java.lang.NullPointerException (no error message)错误

    原文:解决Android Studio运行时报Error:java.lang.NullPointerException (no error message)错误                    ...

  6. Android studio 运行打包 Ionic 项目

    1.创建项目 ionic start myapp tabs 2.cd 到项目文件夹中 3.ionic cordova platfrom add android 执行这个命令后建议修改一下应用包名称,参 ...

  7. AS 新安装Android Studio运行项目前报错:Unable to access Android SDK add-on list

    新安装Android Studio运行项目前报错:Unable to access Android SDK add-on list AS启动后,会在默认路径下检测是否有Android SDK,如果没有 ...

  8. 如何解决android studio 运行时中文乱码的问题

    相信很多朋友都会遇到android studio 在MAC OS中运行的时候中文乱码.而在代码编辑的时候正常.经过几天的不断寻找解决办法,终于解决了 比如: Toast.makeText(MainAc ...

  9. (解决方法)Android studio 运行时报错Do you want to uninstall the existing application?的解决方法

    在Android studio中,有时运行会报错: WARNING: Uninstalling will remove the application data!Do you want to unin ...

随机推荐

  1. UNITY优化资料收集

    U3D手册: Optimizing garbage collection in Unity games https://zhuanlan.zhihu.com/p/25306993 https://gi ...

  2. English Conversation – NUMBERS

    English Conversation – NUMBERS Share Tweet Share Tagged With: Numbers Study the pronunciation of num ...

  3. 关于HashMap多线程下环形链表的总结

    目录 1. 概述 2. 敲黑板的点 3. 为什么会出现循环链表的情况呢?(jdk1.7) 4. jdk1.8中改进了resize方法 5. HashMap的线程安全问题 6. 总结 1. 概述 本文主 ...

  4. gitlab docker安装配置ldap

    镜像下载 直接从dockerhub 下载官方镜像即可 docker pull gitlab/gitlab-ce 首次运行 在某个位置创建一个文件夹并运行如下命令: docker run --hostn ...

  5. Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory

      Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory Link: https:/ ...

  6. Swift的UILabel的一些属性

    let label = UILabel(frame: CGRectMake(,,,)) label.backgroundColor = UIColor.redColor() label.text = ...

  7. k8s 调度器

    https://blog.csdn.net/qq_21816375/article/details/78209605

  8. 用R包中heatmap画热图

    一:导入R包及需要画热图的数据 library(pheatmap) data<- read.table("F:/R练习/R测试数据/heatmapdata.txt",head ...

  9. openssl数字证书常见格式 协议

    证书主要的文件类型和协议有: PEM.DER.PFX.JKS.KDB.CER.KEY.CSR.CRT.CRL .OCSP.SCEP等. PEM – Openssl使用 PEM(Privacy Enha ...

  10. 解决VMware下CentOS连不上网络问题

    https://blog.csdn.net/wangmx1993328/article/details/80897533