Prevent apk decompilation of jocky -- java obfuscation code

Source: Internet
Author: User
Tags echo message

1. Download jocky, decompress the package, and copy the entire folder to the Eclipse plugin directory.
2. Restart Eclipse and right-click the project. If the jocky menu appears, the installation is successful.

 

3. Right-click the project and choose jocky> jocky setting from the shortcut menu.

 

 

 

4. After clicking OK, A jocky_build.xml file will be generated under the root directory of the project, which is actually an ant build file. Open this file and modify it as needed.
<? Xml version = "1.0" encoding = "UTF-8" standalone = "no"?>
<! -- WARNING: Jocky autogenerated file.
Any modifications will be overwritten.
-->
<Project basedir = "." default = "build" name = "iSzmap. Android. public. jocky">
<Property name = "jocky. jar" value = "D: \ eclipse-jee-galileo-SR1-win32-2 \ eclipse \ plugins \ org. apusic. jocky_1.0.3 \ jocky. jar"/>
<Property name = "jocky. output. dir" value = "iszmap"/>
<Property name = "jocky. scramble. level" value = "package"/>
<Property name = "target" value = "1.5"/>
<Path id = "project. classpath">
<Pathelement location = "bin"/>
<Pathelement location = "D:/android-sdk-windows-1.5_r3/platforms/android-1.5/android. jar"/>
</Path>
<Target name = "init">
<Jocky jar = "$ {jocky. jar}" level = "$ {jocky. scramble. level}"/>
<Mkdir dir = "$ {jocky. output. dir}"/>
<Mkdir dir = "$ {jocky. output. dir}/bin"/>
</Target>
<Target name = "clean">
<Delete dir = "$ {jocky. output. dir}/bin"/>
<Delete dir = "$ {jocky. output. dir}"/>
</Target>
<Target depends = "init" name = "build">
<Echo message = "$ {ant. project. name }:$ {ant. file}"/>
<Jocky enable = "true"/>
<Javac destdir = "$ {jocky. output. dir}/bin" target = "$ {target}" encoding = "UTF-8">
<Src path = "src/com/iszmap/android/map"/>
<Classpath refid = "project. classpath"/>
</Javac>
</Target>
</Project>


Pay attention to the red part. The first part is the additional class package required for compilation. The second part is the encoding of the java source file. If your file contains Chinese characters, you must set the encoding; the third part is to set the directory of the source file, because sometimes we only want to output some packages under the src directory, not all.

5. After saving the file, select jocky-jocky Now to perform the mixed code.

The classfile behind the mixed file can be packaged by command, or compressed by winrar, compressed into a. ZIP file instead of A. rar file.

II,
If your java file uses UTF-8 encoding While windows uses gbk encoding by default, the error "unmappable character for encoding GBK" may occur, resulting in the unavailability of jocky. You can solve this problem by modifying the javac segment in jocky_build.xml and adding encoding = "UTF-8" to it.
The reason for this problem is that ant's javac uses the default encoding (if you use windows xp Chinese version, the default encoding is GBK), resulting in inconsistent encoding.
<Javac destdir = "$ {jocky. output. dir}/WebRoot/WEB-INF/classes" target = "$ {target}" encoding = "UTF-8">
<Src path = "src"/>
<Classpath refid = "project. classpath"/>
</Javac>
 
After you get all this, run your android project, copy your apk file from the bin folder, and decompile it with the apk in the previous chapter, check whether there are a large number of disassociated edges. java file, which means it is confused. Good luck, if it succeeds:

 

Author: Yu Yan

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.