2015-10-14 50 views
16

我的应用程序商店中的一个应用程序完美地与Android 5.0,但从今天起我的设备升级到6.0我得到奇怪的错误。我缩小到片段过渡动画。Android 6.0棉花糖:奇怪的错误与片段动画

ftrans.setCustomAnimations(inAnim, outAnim, inAnim, outAnim); 

没有这一行,我的应用程序也能正常工作在6.0,有了它我得到这个错误:

10-14 14:36:51.016 23750-23820/? A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0xb1 in tid 23820 (hwuiTask1) 
10-14 14:36:51.118 200-200/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 
10-14 14:36:51.118 200-200/? A/DEBUG: Build fingerprint: 'google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys' 
10-14 14:36:51.118 200-200/? A/DEBUG: Revision: '0' 
10-14 14:36:51.118 200-200/? A/DEBUG: ABI: 'arm' 
10-14 14:36:51.118 200-200/? A/DEBUG: pid: 23750, tid: 23820, name: hwuiTask1 >>> com.xxx.xxx <<< 
10-14 14:36:51.118 200-200/? A/DEBUG: signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xb1 
10-14 14:36:51.110 200-200/? W/debuggerd: type=1400 audit(0.0:54): avc: denied { search } for name="com.xxx.xxx" dev="mmcblk0p28" ino=1499496 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 
10-14 14:36:51.136 200-200/? A/DEBUG:  r0 00000073 r1 96efeed8 r2 00000002 r3 00000005 
10-14 14:36:51.136 200-200/? A/DEBUG:  r4 00000006 r5 00000073 r6 00000000 r7 96eff1e8 
10-14 14:36:51.136 200-200/? A/DEBUG:  r8 00000005 r9 96efebd8 sl 96eff470 fp 00000016 
10-14 14:36:51.136 200-200/? A/DEBUG:  ip 000000b1 sp 96efebd8 lr 00000006 pc b5d887d2 cpsr 300f0030 
10-14 14:36:51.142 200-200/? A/DEBUG:  #00 pc 0005a7d2 /system/lib/libhwui.so 
10-14 14:36:51.142 200-200/? A/DEBUG:  #01 pc 0005b8a3 /system/lib/libhwui.so 
10-14 14:36:51.142 200-200/? A/DEBUG:  #02 pc 00055e0b /system/lib/libhwui.so 
10-14 14:36:51.142 200-200/? A/DEBUG:  #03 pc 0005c9fd /system/lib/libhwui.so 
10-14 14:36:51.142 200-200/? A/DEBUG:  #04 pc 0001fd93 /system/lib/libhwui.so 
10-14 14:36:51.142 200-200/? A/DEBUG:  #05 pc 0001006d /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112) 
10-14 14:36:51.142 200-200/? A/DEBUG:  #06 pc 0005ecd3 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+70) 
10-14 14:36:51.142 200-200/? A/DEBUG:  #07 pc 0003f3e7 /system/lib/libc.so (__pthread_start(void*)+30) 
10-14 14:36:51.142 200-200/? A/DEBUG:  #08 pc 00019b43 /system/lib/libc.so (__start_thread+6) 
10-14 14:36:51.500 200-200/? W/debuggerd: type=1400 audit(0.0:55): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=5756 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file permissive=0 
10-14 14:36:52.189 799-25288/? W/ActivityManager: Force finishing activity com.xxx.xxx/.MainActivity 
10-14 14:36:52.190 200-200/? E/DEBUG: AM write failed: Broken pipe 
10-14 14:36:52.190 799-815/? I/BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE) 
10-14 14:36:52.257 799-901/? I/OpenGLRenderer: Initialized EGL, version 1.4 
10-14 14:36:52.286 799-4576/? D/GraphicsStats: Buffer count: 5 
10-14 14:36:52.286 799-4576/? I/WindowState: WIN DEATH: Window{d660a8a u0 com.xxx.xxx/com.xxx.xxx.MainActivity} 
10-14 14:36:52.321 799-808/? I/art: Background partial concurrent mark sweep GC freed 71211(4MB) AllocSpace objects, 18(1032KB) LOS objects, 33% free, 32MB/48MB, paused 3.554ms total 114.532ms 
10-14 14:36:52.372 214-214/? I/Zygote: Process 23750 exited due to signal (7) 
10-14 14:36:52.379 799-1413/? I/ActivityManager: Process com.xxx.xxx (pid 23750) has died 
10-14 14:36:52.386 799-1418/? I/ActivityManager: Killing 23069:com.android.documentsui/u0a35 (adj 15): empty #17 
10-14 14:36:52.864 799-817/? W/WindowAnimator: Failed to dispatch window animation state change. 
10-14 14:36:52.864 799-817/? W/WindowAnimator: android.os.DeadObjectException 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.BinderProxy.transactNative(Native Method) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.BinderProxy.transact(Binder.java:503) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.view.Choreographer.doCallbacks(Choreographer.java:670) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.view.Choreographer.doFrame(Choreographer.java:603) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.Handler.handleCallback(Handler.java:739) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.Handler.dispatchMessage(Handler.java:95) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.Looper.loop(Looper.java:148) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at android.os.HandlerThread.run(HandlerThread.java:61) 
10-14 14:36:52.864 799-817/? W/WindowAnimator:  at com.android.server.ServiceThread.run(ServiceThread.java:46) 
10-14 14:36:52.983 1889-2087/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 
10-14 14:36:52.983 1889-2087/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 

的 “在” 动画我用的是这样的:

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:interpolator="@android:interpolator/accelerate_decelerate"> 

<alpha 
    android:fromAlpha="0" android:toAlpha="1" 
    android:startOffset="@integer/fadein_offset" 
    android:duration="@integer/fadein_duration"/> 

<scale 
    android:fromXScale="0%" android:toXScale="100%" android:fromYScale="0%" android:toYScale="100%" 
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:startOffset="@integer/fadein_offset" 
    android:duration="@integer/fadein_duration"/> 

“out”动画看起来完全相同,只是相反。

所以我的问题是,这个错误是什么意思,你如何做棉花糖片段转换?

编辑:我的addFragment方法,其中我使用setCustomAnimations()。我添加了SDK检查,因为我使用的是比较低版本的Android动画。但请注意,此代码适用于Android < 6,动画运行良好,并在3年​​内这样做。

private void addFragment(Fragment f, boolean addToBackstack, String tag) { 
    FragmentManager fman = getSupportFragmentManager(); 
    FragmentTransaction ftrans = fman.beginTransaction(); 

//  if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.HONEYCOMB) { 
//    ftrans.setCustomAnimations(inAnim, outAnim, inAnim, outAnim); 
//  } 

    if(addToBackstack) ftrans.addToBackStack(tag); 
    ftrans.replace(R.id.content, f, tag); 
    ftrans.commit(); 
} 

按下按钮在片段1,我通过接口委托给活动,在那里我称之为

@Override 
public void showFacts(DBCategory category) { 
    addFragment(FragFacts.Instance(category.id(), category.name()), true, FragFacts.TAG); 
} 

编辑2: 我发现这不是一般的动画,它只是规模动画我的转变的一部分导致它。我拿出来了,现在起作用了。

+0

什么时候调用'ftrans.setCustomAnimations(inAnim,outAnim,inAnim,outAnim)'? [From Docs](http://developer.android.com/reference/android/view/View.html#buildLayer())也许视图不再附加到窗口了? – AlbAtNf

+0

我添加了完整的方法,加上我称之为的方法。我只在按下按钮时才会调用它。如上所述,所有这些在Android中完美地工作<6.0 ... – ElDuderino

+0

我也遇到了一些与Android 6.0有关的问题,以前的代码是有效的。 – AlbAtNf

回答

1

这是我们做动画时的棉花糖上的错误。现在,我们找到了一个解决方法通过设置view.setLayerType(View.LAYER_TYPE_SOFTWARE)see documentation

+0

但它不是静态的 –

-1

对我来说是伪装成这一点,因为Proguard的混淆一个空指针异常。 没有Proguard运行,希望你会看到潜在的异常。

-1

我得到这个异常和相同的问题Failed to dispatch window animation state change.android.os.DeadObjectException

显然这是因为我忘记提到清单文件中的活动。 我可以通过在AndroidManifest.xml文件中添加活动来修复它。

只需添加活动类名称后,问题迎刃而解

例如:

<activity 
     android:name="packageName.ClassName" 
     android:configChanges="orientation|keyboardHidden|screenSize|screenLayout" 
     android:screenOrientation="portrait" 
     android:theme="@style/Theme.ActionBarSize_all_view"> 
    </activity> 
-1

就我而言,我的应用程序没有崩溃,但是活动之间的过渡是马车上> 6.0。原因是其中一个活动的styleBackground属性设置为@null。我评论它,它已经修复。

<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">  
    <item name="android:windowBackground">@null</item> 
</style>