wurensen / 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
363 stars 50 forks source link

Execution failed for task ':app:transformClassesWithAjxForPre_productDebugAndroidTest'. > java.lang.NullPointerException (no error message) #76

Open gnmmdk opened 1 year ago

gnmmdk commented 1 year ago

AGP7.2.2环境,debug模式会报错,但是release不会。 前几天AGP升级到8.0.1,但是无法使用,就降回来7.2.2,但是遇到了这个错误。不知道跟之前升级APG到8.0.1有没有关系。

Execution failed for task ':app:transformClassesWithAjxForPre_productDebugAndroidTest'.

java.lang.NullPointerException (no error message)

gnmmdk commented 1 year ago

其他同事的debug包都可以正常打包

wurensen commented 1 year ago

看报错是找不到对应variant下的androidtest相关task,麻烦把你的variant配置贴一下

gnmmdk commented 1 year ago
buildTypes {
    release {
        if (rootProject.ext.jenkins.toBoolean() && rootProject.ext.optimizeBuildSpeed.toBoolean()){

            if(rootProject.ext.environment.contains("develop") || rootProject.ext.environment.contains("test")){
                crunchPngs false
                ext.alwaysUpdateBuildId = false
            }else{
                shrinkResources true
                minifyEnabled true
            }
        }else{
            //移除无用资源,底下两个要一起打开才可以编译通过
            shrinkResources true
            minifyEnabled true
        }
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        if(dokitEnable.toBoolean() && !isAabGoogleplayType()){
            debuggable true
        }else {
            debuggable false
        }
        zipAlignEnabled true
        jniDebuggable false
        renderscriptDebuggable false
        signingConfig signingConfigs.config

        ndk {
            abiFilters "arm64-v8a","armeabi-v7a"
        }
    }
    debug {
        debuggable true
        signingConfig signingConfigs.config
        crunchPngs false
        ext.alwaysUpdateBuildId = false

        ndk {
            abiFilters "armeabi-v7a", "x86","arm64-v8a"
        }
    }
}
wurensen commented 1 year ago

@gnmmdk 你可以把Pre_product这些variant,配置到这个工程的demo试试看能不能复现,这样找问题比较快。我近期比较忙,抽不出时间来找问题~