本文介绍了致命异常:java.lang.NoClassDefFoundError:rt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Fatal Exception: java.lang.NoClassDefFoundError: rt
   at rs.(SourceFile:17)
   at android.support.v7.widget.RecyclerView.onSaveInstanceState(SourceFile:201)
   at android.view.View.dispatchSaveInstanceState(View.java:13651)
   at android.view.ViewGroup.dispatchFreezeSelfOnly(ViewGroup.java:2835)
   at android.support.v7.widget.RecyclerView.dispatchSaveInstanceState(SourceFile:220)
   at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2821)
   at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2821)
   at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2821)
   at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2821)
   at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:2821)
   at android.view.View.saveHierarchyState(View.java:13634)
   at android.support.v4.app.FragmentManagerImpl.saveFragmentViewState(FragmentManager.java:2594)
   at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:2615)
   at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:2678)
   at android.support.v4.app.FragmentController.saveAllState(FragmentController.java:134)
   at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:571)
   at android.support.v7.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:509)
   at android.app.Activity.performSaveInstanceState(Activity.java:1229)
   at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1229)
   at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3390)
   at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3449)
   at android.app.ActivityThread.access$1200(ActivityThread.java:169)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:146)
   at android.app.ActivityThread.main(ActivityThread.java:5487)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
   at dalvik.system.NativeStart.main(NativeStart.java)

推荐答案

我通过在onSavedInstanceState和onStop发行YouTubePlayer来解决此问题.

I fix this by release YouTubePlayer at onSavedInstanceState and onStop.

@Nullable
protected YouTubePlayer mUtPlayer;

@Override
public void onSaveInstanceState(Bundle outState) {
    /* release ut when home button pressed. */
    if (mUtPlayer != null) {
        mUtPlayer.release();
    }
    mUtPlayer = null;
    super.onSaveInstanceState(outState);
}

@Override
public void onStop() {
    /* release ut when go to other fragment or back pressed */
    if (mUtPlayer != null) {
        mUtPlayer.release();
    }
    mUtPlayer = null;
    super.onStop();
}

这篇关于致命异常:java.lang.NoClassDefFoundError:rt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 04:55