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.95k stars 570 forks source link

严重BUG,直接闪退。详情如下 #238

Open diswy opened 4 years ago

diswy commented 4 years ago

AndroidStudio : 3.5.3 kotlin_version : 1.3.50 build:gradle : 3.5.3 直接新建了一个新项目,默认支持Kotlin 根build.gradle中添加classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.8' app的build.gradle中添加apply plugin: 'com.hujiang.android-aspectjx'

未在app中添加该插件的时候,应用可以正常启动,当添加了: apply plugin: 'com.hujiang.android-aspectjx' 再次启动应用,直接闪退,class not found。移除该句,又可以正常运行。

Amoryan commented 4 years ago

我开始也遇到了这个问题,最后发现织入通知的注解写成了@Before,然后接收参数是ProceedingJoinPoint

diswy commented 4 years ago

请问你是如何解决这个问题的?

Petterpx commented 4 years ago

同样遇到了这个问题

langxing commented 4 years ago

同样的问题

fengfutong commented 4 years ago

我搞了一个半小时才发现是这行插件引起的崩溃

apply plugin: 'android-aspectjx'

环境是

as:3.5.3
kotlin:1.3.61
minSdkVersion 21
targetSdkVersion 29
compileSdkVersion 29
buildToolsVersion "29.0.2"
gradle plugin: 3.5.3
gradle-wrapper:5.4.1
androidx

引起的崩溃信息如下:

 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/appcompat/R$drawable;
        at androidx.appcompat.widget.AppCompatDrawableManager$1.<init>(AppCompatDrawableManager.java:63)
        at androidx.appcompat.widget.AppCompatDrawableManager.preload(AppCompatDrawableManager.java:57)
        at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:328)
        at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:278)
        at androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:221)
        at androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:543)
        at androidx.appcompat.app.AppCompatActivity.attachBaseContext(AppCompatActivity.java:98)
        at android.app.Activity.attach(Activity.java:7159)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3073)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3255)
        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.handleMessage(ActivityThread.java:1998)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7042)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.R$drawable" on path: DexPathList[[zip file "/data/app/com.moremom.myapplication-6gnNendt57Fj6COxH4Nfkg==/base.apk"],nativeLibraryDirectories=[/data/app/com.xgc.myapplication-6gnNendt57Fj6COxH4Nfkg==/lib/arm64, /system/lib64]]
EthanCo commented 4 years ago

同样的问题,排查了半天...

diswy commented 4 years ago

只有等作者有空了修复一下了

liaili521 commented 4 years ago

我搞了一个半小时才发现是这行插件引起的崩溃

apply plugin: 'android-aspectjx'

环境是

as:3.5.3
kotlin:1.3.61
minSdkVersion 21
targetSdkVersion 29
compileSdkVersion 29
buildToolsVersion "29.0.2"
gradle plugin: 3.5.3
gradle-wrapper:5.4.1
androidx

引起的崩溃信息如下:

 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/appcompat/R$drawable;
        at androidx.appcompat.widget.AppCompatDrawableManager$1.<init>(AppCompatDrawableManager.java:63)
        at androidx.appcompat.widget.AppCompatDrawableManager.preload(AppCompatDrawableManager.java:57)
        at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:328)
        at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:278)
        at androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:221)
        at androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:543)
        at androidx.appcompat.app.AppCompatActivity.attachBaseContext(AppCompatActivity.java:98)
        at android.app.Activity.attach(Activity.java:7159)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3073)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3255)
        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.handleMessage(ActivityThread.java:1998)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7042)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.R$drawable" on path: DexPathList[[zip file "/data/app/com.moremom.myapplication-6gnNendt57Fj6COxH4Nfkg==/base.apk"],nativeLibraryDirectories=[/data/app/com.xgc.myapplication-6gnNendt57Fj6COxH4Nfkg==/lib/arm64, /system/lib64]]

同样的问题,最后有解决吗

liaili521 commented 4 years ago

AndroidStudio : 3.5.3 kotlin_version : 1.3.50 build:gradle : 3.5.3 直接新建了一个新项目,默认支持Kotlin 根build.gradle中添加classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.8' app的build.gradle中添加apply plugin: 'com.hujiang.android-aspectjx'

未在app中添加该插件的时候,应用可以正常启动,当添加了: apply plugin: 'com.hujiang.android-aspectjx' 再次启动应用,直接闪退,class not found。移除该句,又可以正常运行。

同样的问题,最后有解决吗

lix-b commented 3 years ago

旧版本不支持kotlin