微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > Android常见错误汇总

Android常见错误汇总

时间:10-08 来源:互联网 点击:

xception e) {

Log.v(Error, Error in if。);

}

}

public static void copyFile(InputStream in, OutputStream out) throws IOException {

Log.v(Coping, copyFiling.);

byte[] buffer = new byte[1024];

int read;

while ((read = in.read(buffer)) != -1) {

Log.v(read:, + read);

out.write(buffer, 0, read);

}

}

24.判断是否有root权限

[java] view plaincopyprint?

public static synchronized boolean getRootAhth()

{

Process process = null;

DataOutputStream os = null;

try

{

process = Runtime.getRuntime().exec(su);

os = new DataOutputStream(process.getOutputStream());

os.writeBytes(exit\n);

os.flush();

int exitValue = process.waitFor();

if (exitValue == 0)

{

return true;

} else

{

return false;

}

} catch (Exception e)

{

Log.d(*** DEBUG ***, Unexpected error - Here is what I know:

+ e.getMessage());

return false;

} finally

{

try

{

if (os != null)

{

os.close();

}

process.destroy();

} catch (Exception e)

{

e.printStackTrace();

}

}

}

25.最简单的Root 模拟器的方法

启动一个模拟器,开始-运行-输入cmd,打开dos,依次输入

adb shell

mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

cd /system/bin

cat sh > su

chmod 4755 su

su

即可获得root权限

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top