In the Android application layer when the development of our technical staff will be more or less access to some of the SDK such as So, jar, etc., these are data companies provided to the Internet development Company on the core class of technology
convenient to the East West, because it is the core to encrypt the reinforcement is essential to the work, Benbow today to introduce you to the jar packaging and packaging and confusion, to complete their own sdk! I need to tell you before.
said that So,so is compiled by C + + language, its anti-compilation is more difficult, because the anti-compilation is the assembly language, need to understand the assembly to understand, more importantly, even if the assembly to restore it is a phase
when big projects, especially the SDKs of some big companies, are even less, and jars are more difficult to decompile than so much smaller, so this is also a lot of package name and key verification are put on so why!
jar Encryption Reinforcement Nothing is confusing, as long as you do in this industry for a period of time will know a probably, confusion is to put keep command the variable name, class name, function name ,
attributes, parameter name and so on are all confused into some lowercase letters and so on, so this SDK looks like an abnormal disorder, but previously mentioned, as long as in this industry to do a period of time
, even if the part is confused, but most of the grammar can still find its roots, so the better way is to recommend So+jar
① to package its own SDK through the library
This is the author himself wrote an SDK, which is mainly used to manage WiFi, AP, server file fast transmission, video surveillance of the RTSP push flow framework, ASYNTASK management, network programming, camera management, hard acceleration, LAN multicast, QR code
Build and parse, etc., is the core code for a large project, mainly to reduce the coupling between the architecture and the UI, and secondly, for the sake of security, not much to say that the first introduction to the library package, packaged as a Jar SDK finally introduced the Jar SDK
The confusion reinforcement
First look at the composition of the library, such as:
Androidmanifest.xml the configuration of the manifest file, the following code:
<manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= "Jsp.rtsp.server.camera" > <application android:allowbackup= "true" android:label= "@string/app_name" android: Supportsrtl= "true" > </application></manifest>
we can understand that this is a new Android application project, because this is itself a ndroid application project, just special, create a ndroid application Project
and then fix change the androidmanifest.xml manifest file to remove unnecessary XML nodes, and after completing this step, proceed as follows:
Next, pop up the following box to follow these steps:
The establishment of such a library is complete!
The compilation and dependency compilation of the library is described below
Compile the words directly clean can compile the library, simple rough, then rely on the compilation, or the description of the more profound
or stand-alone select a non-Library Android project, as follows :
After selecting the properties item, the following prompt box appears:
Click OK to confirm the following steps:
After you perform this step, the project generates a new thing, such as:
The following continues to say that the above dependent compilation, after the completion of the above steps, you can start to rely on the compilation, is to clean the library project, but before this need to perform a step, easy to clear the last library
caching, such as step operations, in the library to clean:
This is dependent on the compilation, the advantage of doing so is that it can not be updated every time the compilation of the new library to copy the jar to the project, very convenient!
OK, about the library's Jar SDK package is complete, the following begins to talk about the library SDK confusion and encryption reinforcement!
② the jar SDK for library packaging via Proguard
Proguard use, Proguard in your Android SDK path under the tools directory, such as the author's such as:
Double-click to open, the following describes Proguard use
After clicking Next, you can add your own jar and the obfuscated jar output path that you need to confuse, such as:
Note: The Android.jar dependency needs to be based on its own SDK version, for example, you choose 6.0, that corresponds to the selection of platforms under the SDK directory under android-23 Android.jar
Then select next to proceed to the next step
Continue next to proceed to next step
Here's how to configure confusion, and how to do this:
1. About the confusion of classes:
To add a class that you do not want to be confused:
Add methods that you do not want to be confused:
Add variables that you do not want to be confused:
Confusion about internal classes and internal interfaces, where internal enums are similar
About functions and variables, I am afraid that you understand not clear, just casually demo, such as:
1. Do not confuse the method demo diagram:
First look at the actual code:
/** * @author engineer-jsp * @param android.content.Context Context * @param Jsp.rtsp.server.ap.WiFiApManager.ResponseCallBack call * @return Jsp.rtsp.server.ap.WiFiApManager */public static Wifiapmanager getinstance (Context context, Responsecallback call) {if (Mwifiapmanager = = null) {Mwifiapmanager = new Wifia Pmanager (context, call);} return Mwifiapmanager;}
look again at the confusing configuration:
Argument type can't you see? It's okay, I'll stick it out:
Android.content.context,jsp.rtsp.server.ap.wifiapmanager$responsecallback
You must be wondering why it's wifiapmanager$responsecallback, not wifiapmanager.responsecallback, and this is going to be a detail of this, so let's go ahead and illustrate the confusing configuration of variables
2. Do not confuse variable demo:
First look at an internal class code:
public class Cameramanager {private static Cameramanager Mcameramanager = Null;private MediaStream Mmediastream;public St Atic interface Cameracallback {void onsuccess (int code, string msg); void Oncamerastop (); void onError (int errcode, string E RRMSG);} /** * * @author engineer-jsp * Inner class Demo * */public static class Cameraparameters {public int width;public int height;}
Configure non-confusing variables:
Well, to this the specific configuration of the confusion has been made almost, and the following to tell you about the internal class, internal interface and other calls why sometimes with "$" sometimes with ".", in fact, this is with the specific configuration and
The code is written about, remember when the configuration is confused with the specific prompt box? Yes, that's the key to the call.
If the 2 checkboxes of the red boxes are checked, then the confusing configuration and internal calls after the confusion are not marked with a "$" symbol, using "." Symbols, such as: Wifiapmanager.responsecallback
If the 2 checkboxes of the red box are not checked, then the confusing configuration and the confusion of the internal calls are with the "$" symbol, such as: Wifiapmanager$responsecallback, when the Import guide package is also used "$" and not with the dot symbol, even if the new When creating a new instance object, if he is an internal class, it must be with the $ symbol, as follows to guide the package and create a new instance:
Import Jsp.rtsp.server.ap.wifiapmanager$responsecallback;
Cameramanager$cameraparameters cameraparameters = Cameramanager.getsupportresolution (this);
Therefore, in the case of unchecked, it is recommended that you deliberately use the internal classes and internal interfaces, unless they do not need to be exposed to the developer call, otherwise it is best not to write! This is not standard!
After configuring the specific configuration of the confusion, continue next, probably not to modify the following, until the process option, select the Process button, will begin to confuse the jar
Under the process interface, there are the following buttons to note, such as:
After confusion, use Jd-gui to see the effect:
Compiling through a post-import project with a project that relies on the SDK
Installation:
This project also involves a lot of so libraries, so it is best not to confuse the native method in the JNI aspect, and the C + + Call Java Layer method is best not to confuse!
The introduction of this article is so much, thank you for viewing Bo!
Android Proguard Security Hardening teaches you how to make your application or SDK more difficult to decompile--library package into jars and confuse