HujiangTechnology / gradle_plugin_android_aspectjx

A Android gradle plugin that effects AspectJ on Android project and can hook methods in Kotlin, aar and jar file.
Apache License 2.0
3.94k stars 570 forks source link

java.lang.NoClassDefFoundError #169

Open Ztiany opened 5 years ago

Ztiany commented 5 years ago

root

    dependencies {
        //android
        classpath 'com.android.tools.build:gradle:3.2.1'
        //kotlin
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11'
        //multi channel
        classpath 'com.leon.channel:plugin:2.0.1'
        //aspectJ
        classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
    }

app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.hujiang.android-aspectjx'

dependencies {
        /*Dagger2*/
        kapt thirdLibraries.dagger2Apt
        kapt thirdLibraries.dagger2AndroidApt
        /*ARouter*/
        kapt thirdLibraries.arouterAnnotation
}

error

2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent E/CrashReport: sys default last handle start!
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/gwchina/parent/main/MainActivity;
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.gelei.parent.DaggerAppComponent.getMapOfClassOfAndProviderOfFactoryOf(DaggerAppComponent.java:376)
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.gelei.parent.DaggerAppComponent.getDispatchingAndroidInjectorOfActivity(DaggerAppComponent.java:391)
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.gelei.parent.DaggerAppComponent.injectGWAppContext(DaggerAppComponent.java:551)
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.gelei.parent.DaggerAppComponent.inject(DaggerAppComponent.java:546)
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.gelei.parent.GWAppContext.injectAppContext(GWAppContext.kt:20)
2019-03-20 10:20:34.674 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.sdk.base.AppContext.initApp(AppContext.java:105)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.gwchina.sdk.base.AppContext.onCreate(AppContext.java:70)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5881)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.app.ActivityThread.-wrap1(Unknown Source:0)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1690)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.os.Looper.loop(Looper.java:176)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6701)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:246)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gwchina.parent.main.MainActivity" on path: DexPathList[[zip file "/data/app/com.gwchina.gelei.parent-7wdKFRtYhQ6APmov34YchA==/base.apk"],nativeLibraryDirectories=[/data/app/com.gwchina.gelei.parent-7wdKFRtYhQ6APmov34YchA==/lib/arm, /data/app/com.gwchina.gelei.parent-7wdKFRtYhQ6APmov34YchA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
2019-03-20 10:20:34.675 7179-7179/com.gwchina.gelei.parent W/System.err:    ... 17 more
huize303 commented 5 years ago

同问

feiyang1235 commented 5 years ago

同错误

StephenGiant commented 4 years ago

你们解决了吗?入门遇到这个有点难受啊

oxsource commented 3 years ago

之前怀疑是multi-dex分包的问题,后来找了安卓9.0的机器试了下,还是有NoClassDefFoundError的问题。后来看到项目中用了这个库,使用exclude配置报错的包解决了问题。