自动批改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的模 ...
随机推荐
- 移动web开发(四)——X-UA-Compatible
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> IE=edge告诉 ...
- ARKit从入门到精通(5)-ARScnView介绍
转载:http://blog.csdn.net/u013263917/article/details/73156918 AR视图,在第一小节笔者介绍过,ARKit支持3D的AR场景和2D的AR场景,A ...
- 【Unity】角色沿路线移动/朝着目标移动
先在场景中放置一连串物体作为角色移动路线的关键点,可以把关键点的触发器Trigger拉得大一些方便角色接触到(如酷跑/赛车类项目可以把关键点的触发器做成拦截整个道路的墙面形状).让角色从开始位置朝着第 ...
- C++生成全局唯一Guid
在软件开发中,我们经常需要一个唯一标识来标识一个对象,在PHP中,可以用UUID来获得全局唯一的ID,其实C++也内置了简单的GUID获得办法,猜想GUID应该是本机的特征以及运行的时间的一个哈希值, ...
- Java 原码 反码 补码
本篇文章讲解了计算机的原码, 反码和补码. 并且进行了深入探求了为何要使用反码和补码, 以及更进一步的论证了为何可以用反码, 补码的加法计算原码的减法. 论证部分如有不对的地方请各位牛人帮忙指正! 希 ...
- PHP——大话PHP设计模式——链式操作
- 图像颜色--opencv scalar
Scalar定义可存放1—4个数值的数值,其结构体如下: typedef struct Scalar { double val[4]; }Scalar; 例如:Scalar s: 如果使用的图像是1通 ...
- hbase源码系列(九)StoreFile存储格式
从这一章开始要讲Region Server这块的了,但是在讲Region Server这块之前得讲一下StoreFile,否则后面的不好讲下去,这块是基础,Region Sever上面的操作,大部分都 ...
- PCL深度图像(2)
(1)点云到深度图与可视化的实现 区分点云与深度图本质的区别 1.深度图像也叫距离影像,是指将从图像采集器到场景中各点的距离(深度)值作为像素值的图像.获取方法有:激光雷达深度成像法.计算机立体视觉成 ...
- MongoDB 运行状态、性能监控,分析
这篇文章的目的是让你知道怎么了解你正在运行的Mongdb是否健康.转载自http://tech.lezi.com/archives/290 mongostat详解 启动mongodb监控,通过下面命令 ...