自动批改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的模 ...
随机推荐
- 三者互ping,PC,虚拟机,uboot,nfs网络文件系统搭建
要想实现三者互ping,韦老师虽然专门出了视频说明,但是在自己配置过程还是出现了问题,这里记录一下解决办法,虽然我也不知道原因,但是解决了出现的问题也实现了三者互ping. 首先,我的硬件设备是PC通 ...
- 基于jQuery实现的腾讯互动娱乐网站特效
分享一款基于jQuery实现的腾讯互动娱乐网站特效.腾讯互动娱乐网站jQuery特效是一款右侧带伸缩选项卡,支持鼠标滚轮滚动切换特效代码.效果图如下: 在线预览 源码下载 实现的代码. html代 ...
- AZURE云上 mkfs.ext4 /dev/sdc 导致宕机问题解决纪实
)开机启动挂载配置 [root@pldb2 ~]# vim /etc/fstab You have new mail in /var/spool/mail/root [root@pldb2 ~]# m ...
- nginx servername配置域名网站可以正常登录,servername配置IP+Port却无法正常登录
由于业务的原因,需要将网站从通过域名访问变换为通过IP+PORT的访问方式: 以前的配置: server { listen ; server_name wx.xxxx.com; } 以前的登录页面: ...
- opencv 中affine函数实现旋转和平移
图像旋转和平移是图像处理中常用的一种操作,opencv2和opencv3中对图像的旋转和平移都是通过仿射变换函数cv::warpAffine()来实现的. 1.图像的旋转 图像的旋转具体实现分为两步: ...
- hbase源码系列(八)从Snapshot恢复表
在看这一章之前,建议大家先去看一下snapshot的使用.这一章是上一章snapshot的续集,上一章了讲了怎么做snapshot的原理,这一章就怎么从snapshot恢复表. restoreSnap ...
- 初试 spring web mvc
作为一名code需要了解更多的知识,编程方面的东西太多了,是个逐渐积累的过程.最近学习一下spring web mvc,写下我个人的一些经验. 1.准备jar包.spring mvc 已经到了版本4, ...
- Jenkins+git
https://www.cnblogs.com/Csir/category/1100433.html
- CSS(八):定位属性
一.position属性 1.relative(相对定位) 相对它原来的位置,通过指定偏移,到达新的位置. 扔在标准流中,它对父级盒子和相邻的盒子都没有任何影响. 看下面的例子: <!DOCTY ...
- PHP开发工程师-技能树
参考进阶-PHP程序员的技术成长规划-http://blog.csdn.net/heiyeshuwu/article/details/40098043 LNMP / LAMP 环境搭建(单组件安装,非 ...