chenenyu/Router

有时候会报这个莫名其妙的错

q876625596 opened this issue · 3 comments

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/chenenyu/router/apt/TransactionRouteTable;
at com.chenenyu.router.AptHub.(AptHub.java:34)
at com.chenenyu.router.chain.IntentProcessor.intercept(IntentProcessor.java:32)
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111)
at com.chenenyu.router.chain.IntentValidator.intercept(IntentValidator.java:24)
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111)
at com.chenenyu.router.chain.BaseValidator.intercept(BaseValidator.java:41)
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111)
at com.chenenyu.router.RealRouter.getIntent(RealRouter.java:78)
at com.chenenyu.router.RealRouter.go(RealRouter.java:85)
at com.aaa.my.ui.my.MyFragment$initRV$2.onItemClick(MyFragment.kt:64)
at com.chad.library.adapter.base.BaseQuickAdapter.setOnItemClick(BaseQuickAdapter.java:989)
at com.chad.library.adapter.base.BaseQuickAdapter$5.onClick(BaseQuickAdapter.java:968)
at android.view.View.performClick(View.java:5655)
at android.view.View$PerformClick.run(View.java:22633)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6385)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.chenenyu.router.apt.TransactionRouteTable" on path: DexPathList[[zip file "/data/app/com.aaa.my-1/base.apk"],nativeLibraryDirectories=[/data/app/com.aaa.my-1/lib/arm64, /data/app/com.aaa.my-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.chenenyu.router.AptHub.(AptHub.java:34) 
at com.chenenyu.router.chain.IntentProcessor.intercept(IntentProcessor.java:32) 
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111) 
at com.chenenyu.router.chain.IntentValidator.intercept(IntentValidator.java:24) 
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111) 
at com.chenenyu.router.chain.BaseValidator.intercept(BaseValidator.java:41) 
at com.chenenyu.router.RealInterceptorChain.process(RealInterceptorChain.java:111) 
at com.chenenyu.router.RealRouter.getIntent(RealRouter.java:78) 
at com.chenenyu.router.RealRouter.go(RealRouter.java:85) 
at com.aaa.my.ui.my.MyFragment$initRV$2.onItemClick(MyFragment.kt:64) 
at com.chad.library.adapter.base.BaseQuickAdapter.setOnItemClick(BaseQuickAdapter.java:989) 
at com.chad.library.adapter.base.BaseQuickAdapter$5.onClick(BaseQuickAdapter.java:968) 
at android.view.View.performClick(View.java:5655) 
at android.view.View$PerformClick.run(View.java:22633) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:159) 
at android.app.ActivityThread.main(ActivityThread.java:6385) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883) 

这个错发生在.go()这个方法

TransactionRouteTable有时候会变成其他类,应该是自动生成的,这个错误是我将一个整体app组件拆分出来测试的时候出现的,我测试的包是my,但是他却说TransactionRouteTable这个东西有问题,有时候还是其他的XXXRouteTable有问题

这种情况应该是配置出问题了,参考一下demo里面的配置,如果还没解决,加群联系我。

我也遇到了类似问题,报错如下,clean和rebuild都无效,后来重新拉取代码然后倒入AS解决啦问题。供参考。

java.lang.NoClassDefFoundError: com.chenenyu.router.apt.AppInterceptorTable
│ at com.chenenyu.router.AptHub.(AptHub.java:34)
│ at com.chenenyu.router.Router.injectParams(Router.java:52)