- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我试图使用混淆器混淆我的代码。构建发布 apk 时,它会生成 apk,但代码不会被混淆。请检查我的代码并提供解决方案。
构建.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE.uas.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
defaultConfig {
applicationId "com.infolabs.tv"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/ez_cast_sdk_v_2.1.109.jar')
compile files('libs/gson-2.4.jar')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.github.d-max:spots-dialog:0.4@aar'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.android.support:design:23.3.0'
compile files('libs/Parse-1.8.0.jar')
compile 'com.github.satyan:sugar:1.4'
compile 'de.greenrobot:eventbus:2.4.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
transitive = true;
}
}
这是我的 proguard-rules.pro 文件
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-printmapping out.map
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-keepattributes *Annotation*,Signature,InnerClasses
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keepattributes InnerClasses
-dontoptimize
-repackageclasses ''
-dontwarn android.support.**
-dontwarn android.support.design.**
-dontwarn butterknife.internal.ButterKnifeProcessor
-dontwarn com.parse.**
-dontwarn org.apache.harmony.awt.**
-dontwarn com.sun.mail.imap.protocol.**
-dontwarn com.aem.api.AEMPrinter
-dontwarn com.usb.api.USBPrinter
-dontwarn com.bewo.mach.tools.MACHOPTFPHelper
-dontwarn com.bewo.mach.tools.MACHDPHelper
-dontwarn javax.activation.CommandInfo
-dontwarn com.google.zxing.**
-dontwarn com.actionsmicro.androidkit.ezcast.imp.googlecast.**
-dontwarn org.apache.http.entity.mime.**
-dontwarn com.thetransactioncompany.jsonrpc2.server.MessageContext
-dontwarn com.actionsmicro.d.a.a
-dontwarn com.google.common.**
-dontwarn com.crashlytics.**
-keep public class * extends java.lang.Exception
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
# Library projects.
# Priority jobqueue
#-keep class com.path.android.jobqueue.** { *; }
#-keep interface com.path.android.jobqueue.** { *; }
# Crashlytics Library
-keep class com.crashlytics.** { *; }
-keep interface com.crashlytics.** { *; }
# EventBus Library
-keep class de.greenrobot.event.EventBus.** { *; }
-keep interface de.greenrobot.event.EventBus.** { *; }
# Sugar ORM Library
-keep class com.orm.** { *; }
-keep interface com.orm.** { *; }
# Butterknife library
-keep class butterknife.** { *; }
-keep interface butterknife.** { *; }
-keep class **$$ViewInjector { *; }
# Parse Library
-keep class com.parse.** { *; }
-keep interface com.parse.** { *; }
# Bolts Library
-keep class bolts.** { *; }
-keep interface bolts.** { *; }
# sports dialoge Library
-keep class dmax.dialog.** { *; }
-keep interface dmax.dialog.** { *; }
# MACH Library
#-keep class com.bewo.mach.** { *; }
#-keep interface com.bewo.mach.** { *; }
# SlickUSB2SerialLib Library
#-keep class slickdevlabs.apps.usb2seriallib.** { *; }
#-keep interface slickdevlabs.apps.usb2seriallib.** { *; }
# SwipeMenu Listview Library
#-keep class com.baoyz.swipemenulistview.** { *; }
#-keep interface com.baoyz.swipemenulistview.** { *; }
# Background mail library
#-keep class com.kristijandraca.backgroundmaillibrary.** { *; }
#-keep interface com.kristijandraca.backgroundmaillibrary.** { *; }
# Zxing Library
#-keep class com.google.zxing.** { *; }
#-keep interface com.google.zxing.** { *; }
# ez_cast_sdk
-keep class a.a.a.** { *; }
-keep interface a.a.a.** { *; }
# ez_cast_sdk
-keep class c.a.a.** { *; }
-keep interface c.a.a.** { *; }
-keep class com.google.gson.** { *; }
-keep interface com.google.gson.** { *; }
-keep class com.** { *; }
-keep interface com.** { *; }
# The official support library.
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v7.appcompat.** { *; }
-keep interface android.support.v7.appcompat.** { *; }
# The official design support library.
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }
# Keep fragments
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.Activity
-keep public class * extends android.support.v7.app.ActionBarActivity
-keep public class * extends android.support.v7.app.AppCompatActivity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep class com.infolabs.tv.databases.** { *; }
-dontskipnonpubliclibraryclassmembers
-keep public class * {
public protected *;
}
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# Serializables
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
!private <fields>;
!private <methods>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Native Methods
-keepclasseswithmembernames class * {
native <methods>;
}
# Android Support Library
-keep class android.** {*;}
# Button methods
-keepclassmembers class * {
public void *ButtonClicked(android.view.View);
}
# Reflection
-keepclassmembers class com.elsinga.sample.proguard.SensorDescriptionFragment {
public void updateFields(com.elsinga.sample.proguard.SensorData);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Remove Logging
-assumenosideeffects class android.util.Log {
public static *** e(...);
public static *** w(...);
public static *** wtf(...);
public static *** d(...);
public static *** v(...);
}
最佳答案
您的混淆器配置中有各种过于通用的规则,即保留几乎所有内容。
此规则保留每个公共(public)类中的每个公共(public)或 protected 字段/方法(这样的规则仅对库有用):
-keep public class * {
public protected *;
}
此规则保留包 com 及其子包中的每个类/接口(interface):
-keep class com.** { *; }
-keep interface com.** { *; }
假设您的应用程序包也以 com.
开头,这将防止您的应用程序中的任何内容被混淆。
关于android - Proguard 不会混淆 Android 中的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37970358/
我有几个系统使用 docker-compose 并且没有问题。 但是,我在这里有一个“向下”根本不做任何事情的地方。 'up'虽然完美。这是在 MacOS 上。 该项目的昵称是“ Storm ”,脚本
解释起来确实很奇怪,所以就这样...... 我正在从 phpmyadmin 获取包含未转义单引号的数据。我正在尝试转换'至'通过使用Content-Type: text/html;在 php
伙计们?在这里需要一些帮助。我使用委托(delegate)协议(protocol)将一些字符串从“第二个 View Controller ”传回给它的前一个。 我的数组附加了我在委托(delegate
我有以下 eval() 东西: c = Customer() eval("c.name = row.value('customer', '{c}')".format(c=column_name), {
我写了这个测试类: @ContextConfiguration(locations = { "classpath:/test/BeanConfig.xml" }) public class Candi
我这样写代码: @ContextConfiguration(locations = { "classpath:/test/BeanConfig.xml" }) @RunWith(SpringJUnit
假设我更改了文件,然后进行 pull 。 Git 会报错,因为本地仓库还没有保存,将被覆盖。如果我然后删除该添加并使文件与以前相同(与远程 repo 相同),那么会发生 pull 吗? 最佳答案 是的
我正在阅读《Java for Dummies》一书,但遇到了问题。我不明白为什么 @Override 不起作用。我确信这与我的代码有关,因为我之前已经获得了一个多态数组来使用覆盖,但它对我来说太简单了
我从我的项目中提取了这段代码,因为我试图找到我犯的一个错误,该错误使我的 BeginStoryboard 无法自行停止。我尽可能地简化了代码,但仍然没有发现问题。你认为它可能是什么?
这个问题在这里已经有了答案: Difference between char[] and char * in C [duplicate] (3 个答案) 关闭 7 年前。 我想我知道自己问题的答案,
我一直在使用 java 的 Scanner 类时遇到问题。我可以让它很好地读取我的输入,但问题是当我想要输出一些东西时。给定多行输入,我想在完全读取所有输入后只打印一行。这是我用来读取输入的代码:
对于这个问题,我已经用最简单的术语表达了这一点。 如果元素被点击,'active'类被添加到元素,'active'类从其他元素中移除。 但是,如果该元素是“事件的”并且它被第二次单击,则“事件”类不应
这会在桌面上创建一个新文件夹,但不会将文件夹 .pfrom 的内容 move 到文件夹 .pTo。 int main() { SHFILEOPSTRUCT sf = {0}; TCHA
我有一个关于多线程调试 DLL (/MDd) 和多线程调试 (/MTd) 设置的问题。它们之间的区别很明显:一个是使用动态库,一个是使用静态库。当我使用/MDd 编译我的程序时,一切都进行得很好。但是
我的问题是,如果我在页面加载时创建一个克隆变量,jQuery 只会 append 它一次。奇怪! Click to copy This is an element! $(document)
所以...我是一个开发 django 应用程序的新手,但是当我尝试通过 virtualbox heroku 运行 heroku run python manage.py syncdb 时,它一直在下面
我在 Spring Boot 初始化时遇到了问题。我在一个简单的 Spring Boot 项目中有这个结构。 com.project.name |----App.java (Annoted with
我在 www.7hermanosmx.com/menu.php 页面上有以下代码 - 一切正常,除了黄色框(类 menuholder)应该每行三个相互 float 。他们坚决拒绝这样做!我知道我做错了
我正在尝试在我正在构建的小型网站上添加一个下拉菜单。出于某种原因,我可以获得我想要向下滑动到 fadeOut() 的 div 并执行其他类似的操作,但我无法将它获取到 slideDown()。我不知道
我有一个不能正确 float 的 div。当您切换可见性时,它会覆盖一些当前文本,但我可以稍后移动它。只是好奇为什么它不能正确 float ! Simple Tabs with CSS &am
我是一名优秀的程序员,十分优秀!