gpt4 book ai didi

android - ViewListener 上的 Proguard RoboGuice 混淆错误

转载 作者:行者123 更新时间:2023-11-29 00:21:34 25 4
gpt4 key购买 nike

只要我不打开混淆选项,我就会让 proguard 和 roboguice 一起工作。从我的 progaurd-project.txt 文件中删除 dontobfuscate 后,我收到以下错误:

NullPointerException:
roboguice.inject.ViewListener$ViewMembersInjector.reallyInjectMemberViews (SourceFile:172)
roboguice.inject.ViewListener$ViewMembersInjector.reallyInjectMembers (SourceFile:138)
roboguice.inject.ViewListener$ViewMembersInjector.injectViews (SourceFile:246)
roboguice.inject.ContextScopedRoboInjector.injectViewMembers (SourceFile:270)
roboguice.fragment.RoboFragment.onViewCreated (SourceFile:19)

有没有人对如何修复该错误有任何想法?这是我的配置文件

-libraryjars libs/android-support-v4.jar
-libraryjars libs/commons-codec.jar
-libraryjars libs/crashlytics.jar
-libraryjars libs/eventbus-2.2.0.jar
-libraryjars libs/guava-16.0.1.jar
-libraryjars libs/guice-3.0-no_aop.jar
-libraryjars libs/javax.inject-1.jar
-libraryjars libs/jsr305-1.3.9.jar
-libraryjars libs/library-1.0.1-SNAPSHOT.jar
-libraryjars libs/prettytime-3.2.4.Final.jar
-libraryjars libs/roboguice-2.0.jar
-libraryjars libs/sqlcipher.jar

-libraryjars <java.home>/lib/rt.jar

-dontwarn org.apache.http.**
-dontwarn com.xtremelabs.robolectric.**
-dontwarn com.xtremelabs.robolectric.**
-dontwarn org.junit.runners.**

-optimizationpasses 5
#-dontobfuscate
-dontoptimize
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-dump ../bin/class_files.txt
-printseeds ../bin/seeds.txt
-printusage ../bin/unused.txt
-printmapping ../bin/mapping.txt

# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-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

-keepattributes *Annotation*

-keep class com.google.inject.Binder
-keepclassmembers class * {
@com.google.inject.Inject <init>(...);
}
# There's no way to keep all @Observes methods, so use the On*Event convention to identify event handlers
-keepclassmembers class * {
void *(**On*Event);
}
-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*(...);
}
-keep public class roboguice.**
-keep class **.Finalizer
-keepclassmembers class ** { *** startFinalizer( ... ); }

##---------------Experimental ----------

-allowaccessmodification
-renamesourcefileattribute SourceFile
-repackageclasses ''

-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService

# 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();
}

# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native <methods>;
}


-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}


-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
public void *(android.view.MenuItem);
}

# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static <fields>;
}


# Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}


##---------------Begin: proguard configuration for SQLCipher library ----------

-keep class net.sqlcipher.** {*;}

##---------------Begin: proguard configuration for EventBus library ----------

-keepclassmembers class ** {
public void onEvent*(**);
}


##---------------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


# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }


# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }


##---------------End: proguard configuration for Gson ----------

##---------------Begin: proguard configuration for PrettyTime ----------
-keep class org.ocpsoft.prettytime.i18n.**

##---------------Begin: proguard configuration for Crashliytics ----------
-keepattributes SourceFile,LineNumberTable

最佳答案

我不是 proguard 专家,但看起来它仍在混淆 roboguice 库,即使您将它包含在 -libraryjars 部分中。您可以尝试通过其包将其排除。

-keep class roboguice.** { *; }

关于android - ViewListener 上的 Proguard RoboGuice 混淆错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22738327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com