TestFragment闪退
运行时闪退,不报错。Debug后如下:
点开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蓝色那行后出现下图:
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
截图看不清、log日志不是闪退的日志,你可以在logcat中观察闪退日志
- 参与学习 人
- 提交作业 116 份
- 解答问题 1012 个
本阶段是提升项目经验的必备,除Android开发的高级控件,还有Android官方大力推荐的开发语言Kotlin,未来Android发展的方向,最后使用Kotlin来开发热门电商项目。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星