我选墙纸时遇到了例外情况。我实际上不确定罪魁祸首是什么。这是错误日志:

       I/ActivityManager( 1360): Starting activity: Intent { cmp=com.android.wallpaper.livepicker/.LiveWallpaperPreview (has extras) }
       W/dalvikvm(29175): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)
       E/AndroidRuntime(29175): FATAL EXCEPTION: main
       E/AndroidRuntime(29175): java.lang.IllegalStateException: AssetManager has been finalized!
       E/AndroidRuntime(29175):     at android.content.res.AssetManager.isUpToDate(Native Method)
       E/AndroidRuntime(29175):     at android.app.ActivityThread.getPackageInfo(ActivityThread.java:2350)
       E/AndroidRuntime(29175):     at android.app.ActivityThread.getPackageInfoNoCheck(ActivityThread.java:2337)
       E/AndroidRuntime(29175):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2935)
       E/AndroidRuntime(29175):     at android.app.ActivityThread.access$3300(ActivityThread.java:125)
       E/AndroidRuntime(29175):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
       E/AndroidRuntime(29175):     at android.os.Handler.dispatchMessage(Handler.java:99)
       E/AndroidRuntime(29175):     at android.os.Looper.loop(Looper.java:123)
       E/AndroidRuntime(29175):     at android.app.ActivityThread.main(ActivityThread.java:4627)
       E/AndroidRuntime(29175):     at java.lang.reflect.Method.invokeNative(Native Method)
       E/AndroidRuntime(29175):     at java.lang.reflect.Method.invoke(Method.java:521)
       E/AndroidRuntime(29175):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
       E/AndroidRuntime(29175):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
       E/AndroidRuntime(29175):     at dalvik.system.NativeStart.main(Native Method)
       I/ActivityManager( 1360): Displayed activity com.android.wallpaper.livepicker/.LiveWallpaperPreview: 331 ms (total 331 ms)
       W/InputManagerService( 1360): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44bf5a08
       I/ActivityManager( 1360): Process com.bukabros.videolivewallpaper (pid 29175) has died.
       W/ActivityManager( 1360): Scheduling restart of crashed service com.bukabros.videolivewallpaper/.VideoLiveWallpaper in 5000ms
       I/ActivityManager( 1360): Start proc com.bukabros.videolivewallpaper for service com.bukabros.videolivewallpaper/.VideoLiveWallpaper: pid=29207 uid=10090 gids={}


我唯一能想到的是,当墙纸被拾取时,onCreate的调用顺序不正确,因为cuz是实例化资产管理器的地方。

是的,我正在使用NDK,但是资产管理器并没有在那里使用。

最佳答案

啊没关系。罪魁祸首是资产管理器的句柄是静态变量。 (那只是对其他东西的快速破解)。将其设为普通变量即可解决该问题。

关于android - Assets 经理已经完成?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6380726/

10-10 17:06