自动批改android模拟器的imei的小程序 和 下载各个版本SDK Tools及ADT
ADT 22.6.0版本的下载路径是:http://dl.google.com/android/ADT-22.6.0.zip
ADT22.6.1版本的下载路径是:http://dl.google.com/android/ADT-22.6.1.zip
SDK Tools r22.6版本的下载路径是:http://dl.google.com/android/android-sdk_r22.6-windows.zip
SDK Tools r22.6.1版本的下载路径是:http://dl.google.com/android/android-sdk_r22.6.1-windows.zip
该程序实现一下功能,
1,修改android模拟器的imei,
2,自动启动android模拟器
3,运行开机启动程序,ps:这个开机启动程序apk就没放出来了。
4,停止android模拟器;
重复1,2,3过程
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
try {
while(true){//
eidtEmulator();//修改imei
Runtime rt = Runtime.getRuntime();
String command = "C:\\Program Files\\Android\\android-sdk\\tools\\emulator -avd AVD-10";
rt.exec(command); // 运行android模拟器
System.out.println("success run");
Thread.sleep(2*60*1000);// 等待2分钟后,停止android模拟器
if(findRunningWindowsProcess("emulator-arm.exe")){
killRunningWindowsProcess("emulator-arm.exe");
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void eidtEmulator() throws Exception{
String oldFilePath = "C:\\Program Files\\Android\\android-sdk\\tools\\emulator-arm.exe ";
String newFilePath = "C:\\Program Files\\Android\\android-sdk\\tools\\emulator-arm1.exe";
FileInputStream in = new FileInputStream(oldFilePath);
FileOutputStream out = new FileOutputStream(newFilePath);
byte bytes[] = new byte[1];
byte gsnbytes[] = new byte[3];
byte imeiBytes[] = new byte[15];
int count;
while ((count = in.read(bytes)) != -1) {
out.write(bytes);
if (bytes[0] == 0x43) {// if is char 'C'
count = in.read(gsnbytes);
if (count == -1) {
break;
}
out.write(gsnbytes);
if (gsnbytes[0] == 0x47 && gsnbytes[1] == 0x53 && gsnbytes[2] == 0x4E) {//if is char 'GSN'
count = in.read(bytes);//read char '.'
if (count == -1) {
break;
}
out.write(bytes);
count = in.read(imeiBytes);//read old imei
if (count == -1) {
break;
}
byte[] imeis = getIMEIBytes();
out.write(imeis);//write new imei;
}
}
}
in.close();
out.close();
File oldFile = new File(oldFilePath);
oldFile.delete();
File newFile = new File(newFilePath);
newFile.renameTo(oldFile);
}
public static byte[] getIMEIBytes() {//随即生成15位imei号
StringBuffer bff = new StringBuffer();
byte imeiBytes[] = new byte[15];
for(int i=0;i<imeiBytes.length;i++){
int num = (int) Math.round(Math.random()*8);
bff.append(num);
imeiBytes[i] = Byte.parseByte("3"+num, 16);
}
// printArray(imeiBytes);
System.err.println("start imei: "+bff.toString());
return imeiBytes;
}
public static void printArray(byte bytes[]) {
StringBuffer buff = new StringBuffer();
for (byte b : bytes) {
buff.append(String.format("%02X", b) + " ");
}
System.out.println(buff.toString());
}
public static boolean killRunningWindowsProcess(String processName){
try {
Runtime.getRuntime().exec("taskkill /IM " + processName);
System.out.println("kill process successful");
// System.out.println("Process " + processName + " was killed. Mission completed.");
return true;
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("kill process fail");
System.out.println("Misson failed.");
return false;
}
}
public static boolean findRunningWindowsProcess(String processName) {
BufferedReader bufferedReader = null;
Process proc = null;
try {
proc = Runtime.getRuntime().exec("tasklist /FI \"IMAGENAME eq " + processName + "\"");
bufferedReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
if (line.contains(processName)) {
return true;
}
}
return false;
} catch (Exception ex) {
ex.printStackTrace();
return false;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception ex) {
}
}
if (proc != null) {
try {
proc.destroy();
} catch (Exception ex) {
}
}
}
}
}
http://tieba.baidu.com/p/2343515177
自动批改android模拟器的imei的小程序 和 下载各个版本SDK Tools及ADT的更多相关文章
- 微信小程序0.11.122100版本新功能解析
微信小程序0.11.122100版本新功能解析 新版本就不再吐槽了,整的自己跟个愤青似的.人老了,喷不动了,把机会留给年轻人吧.下午随着新版本开放,微信居然破天荒的开放了开发者论坛.我很是担心官方 ...
- 微信小程序如何下载超过大小限制(10M)的视频?(苹果用户仔细看,安卓用户快速看)
众所周知,微信小程序对下载的文件大小有限制,目前是最大支持10M.我们在用去水印小程序保存视频的时候,如果遇到长视频,视频大小可能就超过限制.遇到这种情况,我们如何才能把视频保存到手机相册呢? 首先, ...
- [解决]小程序要求的 TLS 版本必须大于等于 1.2
今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2 查官方文档 解决方法 在 PowerShell中运行以下内容, 然后重启服务器 # Enab ...
- 小程序报错 TLS 版本必须大于等于 1.2
https://www.cnblogs.com/phpper/p/6866036.html 服务器是windows 2008 server 环境是IIS7SSL是申请用的阿里免费.微信小程序发现wx. ...
- 今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2
今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2 查官方文档 解决方法 在 PowerShell中运行以下内容, 然后重启服务器 # Enab ...
- 微信小程序 使用腾讯地图SDK详解及实现步骤
信小程序 使用腾讯地图SDK详解及实现步骤 微信小程序JavaScript SDK: 官方文档:http://lbs.qq.com/qqmap_wx_jssdk/index.html 步骤: 1 ...
- 小程序报错:对应的服务器 TLS 为 TLS 1.0 ,小程序要求的 TLS 版本必须大于等于 1.2
我这里出现此错误的原因是,搭载域名网站的服务器是windows2008 r2,配置的域名证书是TLS1.0版本,需要在服务器注册表中加入TLS的其他版本. 处理办法如下 小程序报错 TLS 版本必须大 ...
- 小程序 怎么发 beta 版本
小程序 怎么发 beta 版本 微信 https://developers.weixin.qq.com/miniprogram/dev/devtools/mydev.html 小程序助手 支付宝 ht ...
- 解决android模拟器太大,小屏幕无法完全显示的问题
http://hi.baidu.com/conanx/blog/item/05479befd6534d03fdfa3cbb.html 安装上Android模拟器之后,开启一个Android 2.2的模 ...
随机推荐
- 第6章 RTX 操作系统源码方式移植
以下内容转载自安富莱电子: http://forum.armfly.com/forum.php 本章教程为大家将介绍 RTX 操作系统源码方式移植,移植工作比较简单,只需要用户添加需要的源码文件即可, ...
- 青铜到王者,快速提升你 MySQL 数据库的段位!
Reference: https://mp.weixin.qq.com/s?src=11×tamp=1513259125&ver=574&signature=Uxls ...
- Liunx下Intel无线网卡驱动安装
原文: https://blog.csdn.net/u014157776/article/details/78272611 首先查看网卡型号,指令: lspci | grep -i net 如果是In ...
- JS 对应CSS 样式
首先,把CSS和JS标签style属性对照表了解了: CSS 和 JavaScript 标签 style 属性对照表: 盒子标签和属性对照 颜色和背景标签和属性对照 样式标签和属性对照 文字样式标签和 ...
- 微服务之springCloud-docker-feign配置(五)
简介 上一节我们讨论了怎么用feign声明式调用cloud的生产者,这节我们讨论一下feign配置,通过编写配置类,我们可以自定义feign的日志级别,日志扫描目录,可以通过feign调用服务在eur ...
- JS自动关闭授权弹窗,并刷新父页面
echo "<script>window.opener.location.href='index.php'; window.close();</script>&quo ...
- executor.Executor: Managed memory leak detected; size = 37247642 bytes, TID = 5
https://stackoverflow.com/questions/34359211/debugging-managed-memory-leak-detected-in-spark-1-6-0 h ...
- ViewController之间的转场和数据传递
ViewController之间的转场和数据传递 可以正向传递值, 反向传递值. 注意反向传值的时候,方法的位置: https://github.com/urmyfaith/GRDBUsage/blo ...
- android中画图类的介绍Path
Paint类相关属性: /** * Paint类介绍 * * Paint即画笔,在绘图过程中起到了极其重要的作用,画笔主要保存了颜色, * 样式等绘制信息,指定了如何绘制文本和图形,画笔对象有很多设置 ...
- <花荣《至尊狐狸》中国股市精英最优套利战术>读书笔记
书在这里 第一定律:博弈分析是一切实战操作的基础,资金的机会利润由主力投机状态决定,资金的风险承受度由投资标的价值底线锁定 第二定律:套利战术应是背景性的.主动性的.互动性的,是最安全最保守的.最明确 ...