java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class at the start of android app

核能气质少年 提交于 2019-12-21 07:29:06

问题


I'm developing and android countdown app.

In the app you can add or delete as many countdowns as you want.

All the Countdowns are saved in an ArrayList. I can't just save them in an database or in the shared preferences because the countdown have to keep running even if you leave the app.

I'm using roboguice 2.0 and guice-3.0-no_aop.jar to handle my dependency Injections.

Most of the times everthing works fine but sometimes if i start the app i only get the following warning and all the variables like the Arraylist where i saved the countdowns are empty once again.

05-21 13:07:33.260: W/nalizableReferenceQueue(14417): 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.
05-21 13:07:33.260: W/nalizableReferenceQueue(14417): java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.getBaseUrl(FinalizableReferenceQueue.java:269)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$FinalizableReferenceQueue$DecoupledLoader.loadFinalizer(FinalizableReferenceQueue.java:253)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$FinalizableReferenceQueue.loadFinalizer(FinalizableReferenceQueue.java:175)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$FinalizableReferenceQueue.<clinit>(FinalizableReferenceQueue.java:100)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$MapMaker$QueueHolder.<clinit>(MapMaker.java:787)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$MapMaker$WeakEntry.<init>(MapMaker.java:946)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$MapMaker$Strength$1.newEntry(MapMaker.java:312)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(MapMaker.java:498)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$MapMaker$StrategyImpl.newEntry(MapMaker.java:419)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2029)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.Annotations$AnnotationChecker.hasAnnotations(Annotations.java:116)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.Annotations.isBindingAnnotation(Annotations.java:180)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.Key.ensureIsBindingAnnotation(Key.java:366)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.Key.strategyFor(Key.java:338)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.Key.get(Key.java:272)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.AbstractBindingBuilder.annotatedWithInternal(AbstractBindingBuilder.java:82)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.internal.ConstantBindingBuilderImpl.annotatedWith(ConstantBindingBuilderImpl.java:49)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.config.DefaultRoboModule.configure(DefaultRoboModule.java:121)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.spi.Elements.getElements(Elements.java:101)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.google.inject.spi.Elements.getElements(Elements.java:78)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.RoboGuice.setBaseApplicationInjector(RoboGuice.java:81)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.RoboGuice.setBaseApplicationInjector(RoboGuice.java:137)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.RoboGuice.getBaseApplicationInjector(RoboGuice.java:57)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.RoboGuice.getInjector(RoboGuice.java:147)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at roboguice.activity.RoboFragmentActivity.onCreate(RoboFragmentActivity.java:50)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at de.neosit.grafzahl.MainActivity.onCreate(MainActivity.java:38)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.Activity.performCreate(Activity.java:4637)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1051)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.ActivityThread.access$600(ActivityThread.java:127)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.os.Looper.loop(Looper.java:137)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at android.app.ActivityThread.main(ActivityThread.java:4499)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at java.lang.reflect.Method.invokeNative(Native Method)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at java.lang.reflect.Method.invoke(Method.java:511)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
05-21 13:07:33.260: W/nalizableReferenceQueue(14417):   at dalvik.system.NativeStart.main(Native Method)

I can't figure out what is causing this problem. I read that someone had the same problem but the general meening was that this is just a warning and can be ignored. So maybe something else is causing the reset of the varibles.

I hope you can help me. Thanks in advance.


回答1:


In android studio, I changed build.gradle dependencies.

dependencies {
    ...
    compile 'com.google.inject:guice:4.0-beta:no_aop'
    compile 'org.roboguice:roboguice:2.0'
}



回答2:


This seems to be an issue with guide 3.0 no_aop. I upgraded to guice 4.0 (beta) no_aop and the issue went away.

<dependency>
  <groupId>com.google.inject</groupId>
  <artifactId>guice</artifactId>
  <version>4.0-beta</version>
  <classifier>no_aop</classifier>
</dependency>

you'll also need to add an exclusion to the original roboguice dependency:

<dependency>
    <groupId>org.roboguice</groupId>
    <artifactId>roboguice</artifactId>
    <version>2.0</version>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </exclusion>
    </exclusions>
</dependency>



回答3:


According to this issue, the problem is a superficial one. It offers several circularly referenced rabbit holes to explain it, I gave up after the first few. The gist of it is that it can't be garbage collected properly and that if you are "doing funky classloader stuff" you may run into problems.

For me, upgrading to guice 4.0-beta introduced an error regarding com.google.inject.utils.$ImmutableList, which is more problematic than the (apparently) superficial Finalizer issue.



来源:https://stackoverflow.com/questions/16718082/java-io-filenotfoundexception-com-google-inject-internal-util-finalizer-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!