Automatically correct the Android simulator's IMEI applet and download each version of the SDK tools and ADT

Source: Internet
Author: User

The download path for ADT 22.6.0 is: http://dl.google.com/android/ADT-22.6.0.zip

The download path for the ADT22.6.1 version is: Http://dl.google.com/android/ADT-22.6.1.zip

The download path for the SDK Tools r22.6 version is: Http://dl.google.com/android/android-sdk_r22.6-windows.zip

The download path for the SDK Tools r22.6.1 version is: Http://dl.google.com/android/android-sdk_r22.6.1-windows.zip

Automatically modify the Android emulator's IMEI applet

The program realizes the function,

1, modify the IMEI of Android emulator,

2. Start Android Simulator automatically

3, run the boot program, PS: This boot launcher apk is not released.

4. Stop the Android emulator;

Repeat the process of the

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 ();//Modify IMEI

Runtime RT = Runtime.getruntime ();
String command = "C:\\Program Files\\android\\android-sdk\\tools\\emulator-avd AVD-10";
Rt.exec (command); Run the Android emulator
SYSTEM.OUT.PRINTLN ("success run");

Thread.Sleep (2*60*1000);//wait 2 minutes to stop the Android emulator
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 () {//Generate 15-bit IMEI number
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) {
}
}
}
}

}

Andriod SDK Android Simulator modified IMEI code, location information

http://tieba.baidu.com/p/2343515177

Automatically correct the Android simulator's IMEI applet and download each version of the SDK tools and ADT

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.