The implementation method of anti-compiling for Android programming _android

Source: Internet
Author: User

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.

Related Article

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.