programing

장면 전환 애니메이션의 JNI 오류-레이어가 최대 값을 초과합니다.

kingscode 2021. 1. 16. 10:00
반응형

장면 전환 애니메이션의 JNI 오류-레이어가 최대 값을 초과합니다.


질문 하단의 편집을 확인하십시오

두 가지 활동이 있습니다 : ActivityA, ActivityB관련 프래그먼트 : FragmentA, FragmentB각각. ImageView v이 두 조각간에 공유됩니다.

일부 코드 : ActivityA

Intent intent = new Intent(this, ActivityB.class);
final ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.
                         makeSceneTransitionAnimation(this, imageView, "photo");   

ActivityCompat.startActivity(this, intent, activityOptionsCompat.toBundle());

활동 B

FragmentB fragment = new FragmentB();
getFragmentManager().beginTransaction()..replace(R.id.fragment_container, fragment, TAG).addToBackStack(TAG).commit();

FragmentB

mView = (ImageView) view.findViewById(R.id.view);
ViewCompat.setTransitionName(mView, "photo);

5 번 중 4 번 작동합니다. 하지만 작동하지 않을 때 매우 유익한 오류가 발생합니다.

W/OpenGLRenderer﹕ Layer exceeds max. dimensions supported by the GPU (1080x10659, max=4096x4096)
JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.IllegalStateException' thrown in void android.os.MessageQueue.nativePollOnce(long, int):-2

에게 전화 해 Picasso

Picasso.with(context).load(url).centerCrop().resize(width, height).noFade().into(mView);

이를 유발할 수있는 몇 가지 사항 :

  1. in FragmentB mViewposition은ViewTreeObserver.OnGlobalLayoutListener

  2. mViewImageView두 조각 모두에 타원형 효과를 만들기 위해 확장 됩니다.

  3. 뿌리 ViewGroupScrollView

마지막으로 Theme, 두 활동 모두

<style name="Theme" parent="Theme.AppCompat.Light"
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">true</item>
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>

--- 편집하다 ---

내 문제 와 다른 문제에 대한 유사한 질문과 답변

답변은 문제를 해결하지만 API 21 에만 해당됩니다 . 나는 ActivityCompat.startActivity(...). api 16 이상을 지원 하지만 API 19TransitionListener 부터 만 사용할 수 있으며 API 21 부터 지원합니다.SceneTransition

또한 android:transitionGroup="true"필요 API 21지금 내가 가지고 그래서 이 주요 질문 :

  1. LayerExceeds max오류 발생합니까? 내 공유 View는 1080x1080보다 크지 않습니다.
  2. 둘 다 사용할 수없는 API <21 에서 이러한 종류의 오류를 어떻게 처리 할 수 있습니까?TransitionListenertransitionGroup

오류 스택 추적

JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.IllegalStateException' thrown in void android.os.MessageQueue.nativePollOnce(long, int):-2
in call to CallVoidMethodV
art/runtime/check_jni.cc:65] from void android.os.MessageQueue.nativePollOnce(long, int)
art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x72fb6000 self=0xb4827800
art/runtime/check_jni.cc:65]   | sysTid=6497 nice=0 cgrp=default sched=0/0 handle=0xb6f83bec
art/runtime/check_jni.cc:65]   | state=R schedstat=( 1181860917 459124594 2277 ) utm=100 stm=18 core=2 HZ=100
art/runtime/check_jni.cc:65]   | stack=0xbe27d000-0xbe27f000 stackSize=8MB
art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
art/runtime/check_jni.cc:65]   native: #00 pc 00004e64  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
art/runtime/check_jni.cc:65]   native: #01 pc 00003665  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
art/runtime/check_jni.cc:65]   native: #02 pc 00256429  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
art/runtime/check_jni.cc:65]   native: #03 pc 00238fe7  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+158)
art/runtime/check_jni.cc:65]   native: #04 pc 000b191b  /system/lib/libart.so (art::JniAbort(char const*, char const*)+610)
art/runtime/check_jni.cc:65]   native: #05 pc 000b2055  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
art/runtime/check_jni.cc:65]   native: #06 pc 000b530f  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1346)
art/runtime/check_jni.cc:65]   native: #07 pc 000bd6f7  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+42)
art/runtime/check_jni.cc:65]   native: #08 pc 0006244b  /system/lib/libandroid_runtime.so (???)
art/runtime/check_jni.cc:65]   native: #09 pc 000760c5  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
native: #10 pc 0007628d  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
native: #11 pc 00012545  /system/lib/libutils.so (android::Looper::pollInner(int)+484)
native: #12 pc 000125ed  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
native: #13 pc 00081709  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
native: #14 pc 000b3863  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
at android.os.MessageQueue.nativePollOnce(Native method)
at android.os.MessageQueue.next(MessageQueue.java:143)
at android.os.Looper.loop(Looper.java:122)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke!(Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Fatal signal 11 (SIGSEGV), code 1, fault addr 0xfffffff0 in tid 6497 

The accepted answer to the second question you linked discusses the reason this happens: the size limit is on the entire prerendered target Activity, not just the transitioned element(s). Adding android:transitionGroup="true" to the appropriate place in the transitioned layout will fix the crash. You didn't post your layout in the question so it's hard to know where that would go, but if you have a ScrollView or other very long view that would be a good place to start.

For API levels before 21, this is a non-issue. AppCompat.startActivity() will work on API levels below 21, but the shared element transition animation will not run. It will fall back to the default activity transition.

ReferenceURL : https://stackoverflow.com/questions/27769408/jni-error-on-scene-transition-animation-layer-exceeds-max

반응형