自动批改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的模 ...
随机推荐
- log4e下载地址
Log4e的插件的下载地址:log4e.jayefem.de/content/view/3/1/
- Extjs gridpanel 合并单元格
/* * *合并单元格的函数,合并表格内所有连续的具有相同值的单元格.调用方法示例: * *store.on("load",function(){gridSpan(grid,&qu ...
- 收藏mac重装php环境
参考网址: 全新安装Mac OSX 开发者环境 同时使用homebrew搭建 PHP,Nginx ,MySQL,Redis,Memcache ... ... (LNMP开发环境)
- jQuery 实现前端模糊匹配与首字母搜索
实现效果 源码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <t ...
- C语言 · 确定元音字母位置
算法训练 确定元音字母位置 时间限制:1.0s 内存限制:512.0MB 输入一个字符串,编写程序输出该字符串中元音字母的首次出现位置,如果没有元音字母输出0.英语元音字母只有‘a’ ...
- keras系列︱Application中五款已训练模型、VGG16框架(Sequential式、Model式)解读(二)
引自:http://blog.csdn.net/sinat_26917383/article/details/72859145 中文文档:http://keras-cn.readthedocs.io/ ...
- svn cleanup失败
今天用SVN的时候出现被锁定的情况,既不能更新代码也不能提交. 解决方法如下: 1. 在被锁定的文件夹上点右键,找到并点击Clean up菜单项 2. 在Cleanup对话框中勾选“Break loc ...
- Eureka 高可用
spring: profiles: eureka1 server: port: 8001 eureka: instance: hostname: eureka1 client: serviceUrl: ...
- Spring Cloud 5分钟搭建教程(附上一个分布式日志系统项目作为参考) - 推荐
http://blog.csdn.net/lc0817/article/details/53266212/ https://github.com/leoChaoGlut/log-sys 上面是我基于S ...
- springboot项目访问不到controller方法。
访问不到方法首先要从你的controller能否被扫描到出发, 图中显示创建springboot项目自带的这两个的文件要注意把他俩拿出来放到父包下面也就是图中这个位置.如果你的这两个文件在子包里或者说 ...