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. 使用jsoup爬取所有成语

    前几天看到有人在博问上求所有成语,想到刚好看了jsoup,就动手实践了一下,提问者给出了网站,一看很简单,就两种页面,一种是包含某个字的成语链接页面,一个是具体的包含某个字的成语的页面 下面是我的代码 ...

  2. JSFL 禁止脚本运行时间太长的警告

    fl.showIdleMessage(false);

  3. intellij idea 配置web 项目

    Intellij Idea 创建Web项目入门(一)(转载)   相关软件: Intellij Idea14:http://pan.baidu.com/s/1nu16VyD JDK7:http://p ...

  4. LeetCode OJ 89. Gray Code

    题目 The gray code is a binary numeral system where two successive values differ in only one bit. Give ...

  5. LeetCode OJ 145. Binary Tree Postorder Traversal

    Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary t ...

  6. 7.mysql-安装和卸载.md

    目录 卸载 停止window的MySQL服务. 卸载MySQL安装程序.找到"控制面板"-> "程序和功能",卸载MySQL程序. 安装 MYSQL的安装 ...

  7. 【deep learning】斯坦福CS231n—深度学习与计算机视觉(资料汇总)

    官网 链接:CS231n: Convolutional Neural Networks for Visual Recognition Notes: 链接:http://cs231n.github.io ...

  8. stringBuffer和stringBulider的区别

    今天去面试了,问了最基础的stringBuffer和stringBulider的区别,我没有回答出来.之前就知道自己的基础很差,没想到这么差. 网上看了一下资料,stringBuffer和string ...

  9. 2018面向对象程序设计(Java)第12周学习指导及要求

    2018面向对象程序设计(Java)第12周学习指导及要求 (2018.11.15-2018.11.18)   学习目标 (1) 掌握Java GUI中框架创建及属性设置中常用类的API: (2) 掌 ...

  10. justify-content & align-items & align-content

    [justify-content & align-items & align-content] 三个属性均作用于container. justify-content用于控制main-a ...