DefaultLifecycleObserver 使用 (Unknown Source:2) 问题

报错:
2021-11-18 17:53:17.601 2699-2699/com.example.shangxuetang E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sxt, PID: 2699
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
at com.example.sxt.lifecycle.user3.MyObserver2.onCreate(Unknown Source:2)
at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36)
at androidx.lifecycle.LifecycleRegistry O b s e r v e r W i t h S t a t e . d i s p a t c h E v e n t ( L i f e c y c l e R e g i s t r y . j a v a : 354 ) a t a n d r o i d x . l i f e c y c l e . L i f e c y c l e R e g i s t r y . f o r w a r d P a s s ( L i f e c y c l e R e g i s t r y . j a v a : 265 ) a t a n d r o i d x . l i f e c y c l e . L i f e c y c l e R e g i s t r y . s y n c ( L i f e c y c l e R e g i s t r y . j a v a : 307 ) a t a n d r o i d x . l i f e c y c l e . L i f e c y c l e R e g i s t r y . m o v e T o S t a t e ( L i f e c y c l e R e g i s t r y . j a v a : 148 ) a t a n d r o i d x . l i f e c y c l e . L i f e c y c l e R e g i s t r y . h a n d l e L i f e c y c l e E v e n t ( L i f e c y c l e R e g i s t r y . j a v a : 134 ) a t a n d r o i d x . l i f e c y c l e . R e p o r t F r a g m e n t . d i s p a t c h ( R e p o r t F r a g m e n t . j a v a : 68 ) a t a n d r o i d x . l i f e c y c l e . R e p o r t F r a g m e n t . d i s p a t c h ( R e p o r t F r a g m e n t . j a v a : 144 ) a t a n d r o i d x . l i f e c y c l e . R e p o r t F r a g m e n t . o n A c t i v i t y C r e a t e d ( R e p o r t F r a g m e n t . j a v a : 102 ) a t a n d r o i d . a p p . F r a g m e n t . p e r f o r m A c t i v i t y C r e a t e d ( F r a g m e n t . j a v a : 2531 ) a t a n d r o i d . a p p . F r a g m e n t M a n a g e r I m p l . m o v e T o S t a t e ( F r a g m e n t M a n a g e r . j a v a : 1318 ) a t a n d r o i d . a p p . F r a g m e n t M a n a g e r I m p l . m o v e F r a g m e n t T o E x p e c t e d S t a t e ( F r a g m e n t M a n a g e r . j a v a : 1576 ) a t a n d r o i d . a p p . F r a g m e n t M a n a g e r I m p l . m o v e T o S t a t e ( F r a g m e n t M a n a g e r . j a v a : 1637 ) a t a n d r o i d . a p p . F r a g m e n t M a n a g e r I m p l . d i s p a t c h M o v e T o S t a t e ( F r a g m e n t M a n a g e r . j a v a : 3046 ) a t a n d r o i d . a p p . F r a g m e n t M a n a g e r I m p l . d i s p a t c h A c t i v i t y C r e a t e d ( F r a g m e n t M a n a g e r . j a v a : 2998 ) a t a n d r o i d . a p p . F r a g m e n t C o n t r o l l e r . d i s p a t c h A c t i v i t y C r e a t e d ( F r a g m e n t C o n t r o l l e r . j a v a : 182 ) a t a n d r o i d . a p p . A c t i v i t y . p e r f o r m C r e a t e ( A c t i v i t y . j a v a : 7152 ) a t a n d r o i d . a p p . A c t i v i t y . p e r f o r m C r e a t e ( A c t i v i t y . j a v a : 7136 ) a t a n d r o i d . a p p . I n s t r u m e n t a t i o n . c a l l A c t i v i t y O n C r e a t e ( I n s t r u m e n t a t i o n . j a v a : 1272 ) a t a n d r o i d . a p p . A c t i v i t y T h r e a d . p e r f o r m L a u n c h A c t i v i t y ( A c t i v i t y T h r e a d . j a v a : 2932 ) a t a n d r o i d . a p p . A c t i v i t y T h r e a d . h a n d l e L a u n c h A c t i v i t y ( A c t i v i t y T h r e a d . j a v a : 3087 ) a t a n d r o i d . a p p . s e r v e r t r a n s a c t i o n . L a u n c h A c t i v i t y I t e m . e x e c u t e ( L a u n c h A c t i v i t y I t e m . j a v a : 78 ) a t a n d r o i d . a p p . s e r v e r t r a n s a c t i o n . T r a n s a c t i o n E x e c u t o r . e x e c u t e C a l l b a c k s ( T r a n s a c t i o n E x e c u t o r . j a v a : 108 ) a t a n d r o i d . a p p . s e r v e r t r a n s a c t i o n . T r a n s a c t i o n E x e c u t o r . e x e c u t e ( T r a n s a c t i o n E x e c u t o r . j a v a : 68 ) a t a n d r o i d . a p p . A c t i v i t y T h r e a d ObserverWithState.dispatchEvent(LifecycleRegistry.java:354) at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265) at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307) at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148) at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134) at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68) at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:144) at androidx.lifecycle.ReportFragment.onActivityCreated(ReportFragment.java:102) at android.app.Fragment.performActivityCreated(Fragment.java:2531) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1318) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1576) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1637) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3046) at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2998) at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:182) at android.app.Activity.performCreate(Activity.java:7152) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2932) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3087) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)atandroidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)atandroidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)atandroidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)atandroidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)atandroidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)atandroidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:144)atandroidx.lifecycle.ReportFragment.onActivityCreated(ReportFragment.java:102)atandroid.app.Fragment.performActivityCreated(Fragment.java:2531)atandroid.app.FragmentManagerImpl.moveToState(FragmentManager.java:1318)atandroid.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1576)atandroid.app.FragmentManagerImpl.moveToState(FragmentManager.java:1637)atandroid.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3046)atandroid.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2998)atandroid.app.FragmentController.dispatchActivityCreated(FragmentController.java:182)atandroid.app.Activity.performCreate(Activity.java:7152)atandroid.app.Activity.performCreate(Activity.java:7136)atandroid.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)atandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:2932)atandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3087)atandroid.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)atandroid.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)atandroid.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)atandroid.app.ActivityThreadH.handleMessage(ActivityThread.java:1817)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit M e t h o d A n d A r g s C a l l e r . r u n ( R u n t i m e I n i t . j a v a : 493 ) a t c o m . a n d r o i d . i n t e r n a l . o s . Z y g o t e I n i t . m a i n ( Z y g o t e I n i t . j a v a : 858 ) C a u s e d b y : j a v a . l a n g . C l a s s N o t F o u n d E x c e p t i o n : D i d n ′ t f i n d c l a s s " k o t l i n . j v m . i n t e r n a l . I n t r i n s i c s " o n p a t h : D e x P a t h L i s t [ [ z i p f i l e " / d a t a / a p p / c o m . e x a m p l e . s h a n g x u e t a n g − c N k w 6 e e t T L i h Q K j P n n Q e S w = = / b a s e . a p k " ] , n a t i v e L i b r a r y D i r e c t o r i e s = [ / d a t a / a p p / c o m . e x a m p l e . s h a n g x u e t a n g − c N k w 6 e e t T L i h Q K j P n n Q e S w = = / l i b / a r m 64 , / s y s t e m / l i b 64 ] ] a t d a l v i k . s y s t e m . B a s e D e x C l a s s L o a d e r . f i n d C l a s s ( B a s e D e x C l a s s L o a d e r . j a v a : 134 ) a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( C l a s s L o a d e r . j a v a : 379 ) a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( C l a s s L o a d e r . j a v a : 312 ) a t c o m . e x a m p l e . s h a n g x u e t a n g . l i f e c y c l e . u s e r 3. M y O b s e r v e r 2. o n C r e a t e ( U n k n o w n S o u r c e : 2 ) a t a n d r o i d x . l i f e c y c l e . F u l l L i f e c y c l e O b s e r v e r A d a p t e r . o n S t a t e C h a n g e d ( F u l l L i f e c y c l e O b s e r v e r A d a p t e r . j a v a : 36 ) a t a n d r o i d x . l i f e c y c l e . L i f e c y c l e R e g i s t r y MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.example.shangxuetang-cNkw6eetTLihQKjPnnQeSw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.shangxuetang-cNkw6eetTLihQKjPnnQeSw==/lib/arm64, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.example.shangxuetang.lifecycle.user3.MyObserver2.onCreate(Unknown Source:2) at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36) at androidx.lifecycle.LifecycleRegistry MethodAndArgsCaller.run(RuntimeInit.java:493)atcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)Causedby:java.lang.ClassNotFoundException:Didntfindclass"kotlin.jvm.internal.Intrinsics"onpath:DexPathList[[zipfile"/data/app/com.example.shangxuetangcNkw6eetTLihQKjPnnQeSw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.shangxuetangcNkw6eetTLihQKjPnnQeSw==/lib/arm64,/system/lib64]]atdalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)atjava.lang.ClassLoader.loadClass(ClassLoader.java:379)atjava.lang.ClassLoader.loadClass(ClassLoader.java:312)atcom.example.shangxuetang.lifecycle.user3.MyObserver2.onCreate(UnknownSource:2)atandroidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36)atandroidx.lifecycle.LifecycleRegistryObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:144)
at androidx.lifecycle.ReportFragment.onActivityCreated(ReportFragment.java:102)
at android.app.Fragment.performActivityCreated(Fragment.java:2531)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1318)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1576)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1637)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3046)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2998)
at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:182)
at android.app.Activity.performCreate(Activity.java:7152)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2932)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3087)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread H . h a n d l e M e s s a g e ( A c t i v i t y T h r e a d . j a v a : 1817 ) a t a n d r o i d . o s . H a n d l e r . d i s p a t c h M e s s a g e ( H a n d l e r . j a v a : 106 ) a t a n d r o i d . o s . L o o p e r . l o o p ( L o o p e r . j a v a : 193 ) a t a n d r o i d . a p p . A c t i v i t y T h r e a d . m a i n ( A c t i v i t y T h r e a d . j a v a : 6746 ) a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( N a t i v e M e t h o d ) a t c o m . a n d r o i d . i n t e r n a l . o s . R u n t i m e I n i t H.handleMessage(ActivityThread.java:1817) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6746) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit H.handleMessage(ActivityThread.java:1817)atandroid.os.Handler.dispatchMessage(Handler.java:106)atandroid.os.Looper.loop(Looper.java:193)atandroid.app.ActivityThread.main(ActivityThread.java:6746)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.RuntimeInitMethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

处理:
增加依赖

dependencies {
    implementation 'io.alterac.blurkit:blurkit:1.0.0'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61'
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值