我正在开发和 android 倒计时应用程序。
在应用程序中,您可以根据需要添加或删除任意数量的倒计时。
所有的倒计时都保存在一个 ArrayList 中。我不能只将它们保存在数据库或共享首选项中,因为即使您离开应用程序,倒计时也必须继续运行。
我正在使用 roboguice 2.0 和 guice-3.0-no_aop.jar 来处理我的依赖注入。
大多数时候一切正常,但有时如果我启动应用程序,我只会收到以下警告,并且我保存倒计时的 Arraylist 等所有变量再次为空。
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)
我无法弄清楚是什么导致了这个问题。我读到有人遇到了同样的问题,但普遍认为这只是一个警告,可以忽略。所以也许是别的东西导致了变量的重置。
我希望你能帮助我。提前致谢。