TestFragment闪退

TestFragment闪退

运行时闪退,不报错。Debug后如下:

http://img1.sycdn.imooc.com//climg/60d43ac80927d9d505540346.jpg

点开Variables   中的this:

((MainActivity)this).shadow$_monitor_ = Expecting ')'; looking at ERROR_ELEMENT '(1,16) in /fragment.kt
this = {MainActivity@12495}
 _$_findViewCache = null
 ProxyActivity._$_findViewCache = null
 mDelegate = {SupportActivityDelegate@12504}
 AppCompatActivity.mDelegate = {AppCompatDelegateImpl@12505}
 mResources = null
 mCreated = false
 mFragmentLifecycleRegistry = {LifecycleRegistry@12506}
 mFragments = {FragmentController@12507}
 mNextCandidateRequestIndex = 0
 mPendingFragmentActivityResults = {SparseArrayCompat@12508} "{}"
 mRequestedPermissionsFromFragment = false
 mResumed = false
 mStartedActivityFromFragment = false
 mStartedIntentSenderFromFragment = false
 mStopped = true
 mContentLayoutId = 0
 mLifecycleRegistry = {LifecycleRegistry@12509}
 mOnBackPressedDispatcher = {OnBackPressedDispatcher@12510}
 mSavedStateRegistryController = {SavedStateRegistryController@12511}
 mViewModelStore = {ViewModelStore@12512}
 mExtraDataMap = {SimpleArrayMap@12513} "{}"
 ComponentActivity.mLifecycleRegistry = {LifecycleRegistry@12514}
 mActionBar = null
 mActionModeTypeStarting = 0
 mActivityInfo = {ActivityInfo@12515} "ActivityInfo{ed673b9 com.example.mall.MainActivity}"
 mActivityTransitionState = {ActivityTransitionState@12516}
 mApplication = {MallExampleApp@12517}
 mAutoFillIgnoreFirstResumePause = false
 mAutoFillResetNeeded = false
 mAutofillManager = null
 mAutofillPopupWindow = null
 mCalled = true
 mCanEnterPictureInPicture = true
 mChangeCanvasToTranslucent = false
 mChangingConfigurations = false
 mComponent = {ComponentName@12518} "ComponentInfo{com.example.mall/com.example.mall.MainActivity}"
 mConfigChangeFlags = 0
 mCurrentConfig = {Configuration@12519} "{1.0 454mcc7mnc [zh_CN_#Hans] ldltr sw360dp w360dp h696dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2160) mAppBounds=Rect(0, 0 - 1080, 2160) mWindowingMode=fullscreen mActivityType=standard} nonFullScreen=0 suim:1 s.7}"
 mCustActivity = null
 mDecor = null
 mDefaultKeyMode = 0
 mDefaultKeySsb = null
 mDestroyed = false
 mDoReportFullyDrawn = true
 mEmbeddedID = null
 mEnableDefaultActionBarUp = false
 mEnterTransitionListener = {SharedElementCallback$1@12520}
 mExitTransitionListener = {SharedElementCallback$1@12520}
 mFinished = false
 Activity.mFragments = {FragmentController@12521}
 mHandler = {Handler@12522} "Handler (android.os.Handler) {8f1295e}"
 mHasCurrentPermissionsRequest = false
 mIdent = 146860787
 mInstanceTracker = {StrictMode$InstanceTracker@12523}
 mInstrumentation = {Instrumentation@12524}
 mIntent = {Intent@12525} "Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.mall/.MainActivity }"
 mIsFullFlag = false
 mLastAutofillId = 1073741823
 mLastNonConfigurationInstances = null
 mMainThread = {ActivityThread@12526}
 mManagedCursors = {ArrayList@12527}  size = 0
 mManagedDialogs = null
 mMenuInflater = null
 mNavigationBarColor = 0
 mParent = null
 mReferrer = null
 mRestoredFromBundle = false
 mResultCode = 0
 mResultData = null
 Activity.mResumed = false
 mSearchEvent = null
 mSearchManager = null
 mStartedActivity = false
 Activity.mStopped = false
 mTaskDescription = {ActivityManager$TaskDescription@12528} "TaskDescription Label: null Icon: null IconRes: 0 IconFilename: null colorPrimary: -10354450 colorBackground: -328966 statusBarColor: -328966 navigationBarColor: -16974597"
 mTemporaryPause = false
 mTitle = "MallKotlin"
 mTitleColor = 0
 mTitleReady = false
 mToken = {BinderProxy@12530}
 mTranslucentCallback = null
 mUiThread = {Thread@12002} "Thread[main,5,main]"
 mVisibleFromClient = true
 mVisibleFromServer = false
 mVoiceInteractor = null
 mWindow = {HwPhoneWindow@12531}
 mWindowAdded = false
 mWindowManager = {WindowManagerImpl@12532}
 mZrHungAppEyeUiProbe = {AppEyeUiProbe@12533}
 mInflater = {HwPhoneLayoutInflater@12534}
 mOverrideConfiguration = null
 ContextThemeWrapper.mResources = {HwResources@12535}
 mTheme = {Resources$Theme@12536}
 mThemeResource = 2131558409
 mBase = {ContextThemeWrapper@12537}
 shadow$_klass_ = {Class@12068} "class com.example.mall.MainActivity"
 shadow$_monitor_ = -1973317003


点击Frames蓝色那行后出现下图:

http://img1.sycdn.imooc.com//climg/60d43af8094dac4b05540346.jpg

Variables变量表显示:

​((MainActivity)this).shadow$_monitor_ = Expecting ')'; looking at ERROR_ELEMENT '(1,16) in /fragment.kt
this = {MainActivity@12496}
savedInstanceState = null

也就是说在ProxyActivity.kt中的initContainer(savedInstanceState)​中的savedInstanceState为空

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
LovelyChubby 2021-06-24 19:18:06

截图看不清、log日志不是闪退的日志,你可以在logcat中观察闪退日志

  • 提问者 慕运维0750787 #1
    哪个才是闪退标识?不知道啊,没有其它出错显示啊
    2021-06-25 10:38:34
  • 提问者 慕运维0750787 #2
    就算截图不清楚,文字复制的也是截图提示的内容呀,你也可以看文字部分
    2021-06-25 10:39:21
  • 提问者 慕运维0750787 #3
    LogCat没有报错
    2021-06-25 10:47:43
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师