This article is an example of the implementation of the anti-compile method of Android programming. Share to everyone for your reference, specific as follows:
1. Determine if the program is running on the simulator
Boolean Isrunninginemualtor () {Boolean qemukernel = false;
Process process = NULL;
DataOutputStream OS = null;
try{process = Runtime.getruntime (). EXEC ("Getprop ro.kernel.qemu");
OS = new DataOutputStream (Process.getoutputstream ());
BufferedReader in = new BufferedReader (New InputStreamReader (Process.getinputstream (), "GBK"));
Os.writebytes ("exit\n");
Os.flush ();
Process.waitfor (); Getprop Ro.kernel.qemu = = 1 in simulator//getprop Ro.product.model = = "SDK" in Simulator//Getprop ro.build.tags = "Test-keys"
"in the simulator Qemukernel = (integer.valueof (in.readline ()) = = 1);
LOG.D ("Com.droider.checkqemu", "Detect simulator:" + Qemukernel);
catch (Exception e) {qemukernel = false;
LOG.D ("Com.droider.checkqemu", "Run Failed" + e.getmessage ());
Finally {try{if (OS!= null) {os.close ();
} Process.destroy ();
catch (Exception e) {} log.d ("Com.droider.checkqemu", "Run Finally");
return qemukernel;
}
2. Detect KeyStore signature and compare it to before
public int getsignature (String packagename) {
Packagemanager pm = This.getpackagemanager ();
PackageInfo pi = null;
int sig = 0;
try {
pi = pm.getpackageinfo (PackageName, packagemanager.get_signatures);
Signature[] s = pi.signatures;
sig = S[0].hashcode ();
} catch (Exception E1) {
sig = 0;
E1.printstacktrace ();
}
return sig;
}
3. Test package name, version name and version number, and then make a judgment:
Private String Getappinfo () {
try {
string pkname = This.getpackagename ();
String versionname = This.getpackagemanager (). Getpackageinfo (
pkname, 0). versionname;
int versioncode = This.getpackagemanager ()
. Getpackageinfo (pkname, 0). Versioncode;
return pkname + "" + Versionname + "" + Versioncode;
} catch (Exception e) {
} return
null;
}
4. Write JPG images in PNG format but the latest version of Apktool has been repaired.
5. Flower instruction, affect Jd-gui but the latest version of Jd-gui has been repaired
private static final char[] WJ = "0123456789abcdef". ToCharArray ();
public static String IMSI = "204046330839890";
public static String p = "0";
public static String keyword = "phone";
public static String Tranlatekeyword = "%e7%94%b5%e8%af%9d";
In each class add as above field ....
https://***/A third party "Love Encryption" Site 1. The Official Packaging key tool needs to be packaged and uploaded to the "Love Encryption" site for processing, and then downloaded to the site, download and then use the "Love Encryption" packaging tools to be packaged again.
I hope this article will help you with the Android program.