Android項目代碼混淆,android項目混淆

來源:互聯網
上載者:User

Android項目代碼混淆,android項目混淆

項目根目錄有兩個檔案:


1.project.properties

# This file is automatically generated by Android Tools.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file must be checked in Version Control Systems.## To customize properties used by the Ant build system edit# "ant.properties", and override values to adapt the script to your# project structure.## To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):sdk.dir=D:\Androidpmtoam\adt-bundle-windows-x86_64-20131030\sdkproguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt# Project target.target=android-19

2.proguard-project.txt

# To enable ProGuard in your project, edit project.properties# to define the proguard.config property as described in that file.## Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in ${sdk.dir}/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the ProGuard# include property in project.properties.## For more details, see#   http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:-keepclassmembers class fqcn.of.javascript.interface.for.webview {   public *;}-optimizationpasses 5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontpreverify-verbose-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*-keep public class * extends android.app.Activity-dontwarn com.google.**-keep class com.google.** {*;}-dontwarn com.baidu.**-keep class com.baidu.** {*;}-dontwarn net.sqlcipher.**-keep class net.sqlcipher.** {*;}# Explicitly preserve all serialization members. The Serializable interface# is only a marker interface, so it wouldn't save them.-keepclassmembers class * implements java.io.Serializable {    static final long serialVersionUID;    private static final java.io.ObjectStreamField[] serialPersistentFields;    private void writeObject(java.io.ObjectOutputStream);    private void readObject(java.io.ObjectInputStream);    java.lang.Object writeReplace();    java.lang.Object readResolve();}-keep public class * implements java.io.Serializable {*;}##---------------Begin: proguard configuration for Gson  ----------# Gson uses generic type information stored in a class file when working with fields. Proguard# removes such information by default, so configure it to keep all of it.-keepattributes Signature# For using GSON @Expose annotation-keepattributes *Annotation*# Gson specific classes-keep class sun.misc.Unsafe { *; }-keep class com.dooioo.eal.entity.** { *; }# Application classes that will be serialized/deserialized over Gson-keep class com.google.gson.examples.android.model.** { *; }##---------------End: proguard configuration for Gson  ----------



安卓編程 怎進行代碼混淆

安卓在eclipse中的ADT已經改變原有的模式了,你在專案檔中找到這兩個檔案,一般在項目根目錄裡。

第一個檔案是描述檔案,第二個檔案是設定檔。
如果要實現代碼混淆,需要修改第二個檔案。開啟第二個檔案,如下:

其中紅線部分說,如果你要實現代碼混淆,你需要把下面一行給反注釋掉。
就是把紅線第二行前面的#號給去掉就好了。

如果有回答不當之處,還望見諒。


 
android怎混淆代碼

如果你沒用到第三方的library或者jar包,那麼只要在工程目錄下project.properties裡面,把#proguard.config=xxxxxx前面的#去掉就好了。如果有第三方的jar包,那麼把需要的配置加到proguard-project.txt裡面就好。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.