android - Proguard 与 Roboguice

标签 android android-proguard

我在应用程序中打开了 proguard 我在应用程序 onCreate 中有一个警告

RoboGuice.injectMembers(_appContext, this);

异常:

nalizableReferenceQueue﹕ Could not load Finalizer in its own class loader. Loading Finalizer in the current class loader instead. As a result, you will not be able to garbage collect this class loader. To support reclaiming this class loader, either resolve the underlying issue, or move Google Collections to your system class path.
    java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class
            at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.getBaseUrl(SourceFile:269)
            at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.loadFinalizer(SourceFile:253)
            at com.google.inject.internal.util.$FinalizableReferenceQueue.loadFinalizer(SourceFile:175)
            at com.google.inject.internal.util.$FinalizableReferenceQueue.<clinit>(SourceFile:100)
            at com.google.inject.internal.util.$MapMaker$QueueHolder.<clinit>(SourceFile:787)
            at com.google.inject.internal.util.$MapMaker$WeakEntry.<init>(SourceFile:946)
            at com.google.inject.internal.util.$MapMaker$Strength$1.newEntry(SourceFile:312)
            at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(SourceFile:498)
            at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(SourceFile:419)
            at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(SourceFile:2029)
            at com.google.inject.internal.Annotations$AnnotationChecker.hasAnnotations(SourceFile:116)
            at com.google.inject.internal.Annotations.isBindingAnnotation(SourceFile:180)
            at com.google.inject.Key.ensureIsBindingAnnotation(SourceFile:366)
            at com.google.inject.Key.strategyFor(SourceFile:338)
            at com.google.inject.Key.get(SourceFile:272)
            at com.google.inject.internal.AbstractBindingBuilder.annotatedWithInternal(SourceFile:82)
            at com.google.inject.internal.ConstantBindingBuilderImpl.annotatedWith(SourceFile:49)
            at roboguice.config.DefaultRoboModule.configure(SourceFile:117)
            at com.google.inject.AbstractModule.configure(SourceFile:59)
            at com.google.inject.spi.Elements$RecordingBinder.install(SourceFile:223)
            at com.google.inject.spi.Elements.getElements(SourceFile:101)
            at com.google.inject.spi.Elements.getElements(SourceFile:78)
            at roboguice.RoboGuice.setBaseApplicationInjector(SourceFile:83)
            at roboguice.RoboGuice.setBaseApplicationInjector(SourceFile:139)
            at roboguice.RoboGuice.getBaseApplicationInjector(SourceFile:59)
            at roboguice.RoboGuice.getInjector(SourceFile:149)
            at roboguice.RoboGuice.injectMembers(SourceFile:156)
            at com.package.MyApplication.x(SourceFile:847)
            at com.package.MyApplication.onCreate(SourceFile:243)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4712)
            at android.app.ActivityThread.-wrap1(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5422)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

我在我的 proguard 文件中包含:

-keep public class * extends android.app.Application
-keep class com.google.inject.** { *; }
-keep class javax.inject.** { *; }
-keep class javax.annotation.** { *; }
-keep class roboguice.** { *; }

我还应该做什么?

最佳答案

添加到你的proguard文件

-keep class com.google.inject.internal.util.$Finalizer { *; }

关于android - Proguard 与 Roboguice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37118737/

相关文章:

android - 写入文件并执行。 py文件在android python 3

android - 复古贴合响应与 Pro Guard 崩溃

android - Proguard 抛出自定义选项卡警告和构建失败

android - 运行 espresso 的 UIAutomator

android - 使用JACK时生成的proguard mappings.txt文件在哪里?

android - Proguard标志dontobfuscate导致Translation has been interrupted异常

android - 生成签名的APK错误

android - Android 中的 LinkedIn 集成

android - 通过从SharedPreference填充Textview使Android应用程序崩溃

java - onAttach 中无法初始化接口(interface)对象?