代碼混淆是apk加固的一個重要部分,res文件混淆也是代碼混淆的其中一個工作,主要是混淆res文件夾下的layout的xml文件,混淆後如果打開就是亂碼。
android代碼混淆是指安卓開發者或者組織為了防止自己的產品敏感信息或者技術機密被人破解,而在生成apk文件的時候,通過設置一些替換規則,使java文件中指定的代碼類的名字或者成員名字變為沒有任何意義的字母,然後編譯成class文件的過程。
已經混淆過的android代碼反編譯出來的都是一些沒有任何意義的名字,是很難讀懂的。沒有好的辦法。
㈢ 安卓開發對apk進行混淆,混淆後老是abcd的,能不能設置成其他內容
防逆向:通過對代碼進行隱藏以及加密處理,使攻擊者無法對二進制代碼進行反編譯,獲得源代碼或代碼運行邏輯。
為了預防APK包被篡改的風險,可以把APP上傳到騰訊御安全加固打個包,再放到伺服器上給用戶下載,更安全一些。
㈣ Android-android 怎麼實現只混淆自己的代碼,而不混淆第3方jar包
為了解決第三方包不被混淆,第三方包在混淆後,運行的時候會掛掉。我的錯誤是java.lang.ExceptionInInitializerError
[java] E/AndroidRuntime( 9608):
java.lang.ExceptionInInitializerError
E/AndroidRuntime( 9608): at
a.a.b.f.<init>(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.b.e.<init>(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.dg.b(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.dg.a(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.b.a(Unknown Source)
E/AndroidRuntime( 9608): at
a.a.c.ad.a(Unknown Source)
………………………………………………………………………………中間部分省略
最終我通過 加LOG的調試方法定位到是由於第三方jar包被混淆後的原因導致的。
解決方法:
在proguard-android.txt文件最後加入了-keep class org.jsoup.**這樣一句代碼,就是保持這個類不被混淆
附上proguard-android.txt源文件[html] # This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-
-verbose
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
-keep class org.jsoup.**
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-
-verbose
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
-keep class org.jsoup.**
㈤ Android如何保持指定類不被混淆
包名 package com.example.test
類名 public class WebAppInterface{}
加上完整的包名才行。
-keep class com.example.test.WebAppInterface {*;}
㈥ android代碼混淆時,如何防止第三方jar包被
rules文件加上類似: -keep public class * extends android.app.Fragment
可以選擇不混淆哪些類
㈦ 安卓代碼混淆怎麼快速混淆實體類
我覺得一般實體的變數名不混淆就可以了, 一般反射操作實體都是通過Field操作變數, java 裡面setXXX/getXXX 和XXX沒有直接的聯系, setXXX完全可以在set YYY
回答不容易,希望能幫到您,滿意請幫忙採納一下,謝謝 !
㈧ 安卓的apk文件加密保護如何做最近經常遇到apk被破解的情況!!求大神指點
遇到apk被破解的情況,現在很常見啊!推薦你一個apk應用加密服務平台,加密過程不需要應用改動任何源代碼,兼容性和運行效率也不會受到任何影響。是移動互聯網行業權威的移動應用安全服務提供商,現愛加密已經為3000多家移動應用開發者提供安全保護服務,保護App數量超過6000個,並與史上最坑爹的游戲、WiFi伴侶、兜兜公交、銅板街、Cindy歷險記、美食傑、3D寶軟桌面等多款知名應用合作,建議你去愛加密官網看看!
㈨ 安卓編程 如何進行代碼混淆
安卓在eclipse中的ADT已經改變原有的模式了,你在項目文件中找到這兩個文件,一般在項目根目錄里。
如果有回答不當之處,還望見諒。
㈩ Android如何保持指定類不被混淆
包名 package com.example.test
類名 public class WebAppInterface{}
加上完整的包名才行。
-keep class com.example.test.WebAppInterface {*;}