bytedance / ByteX

ByteX is a bytecode plugin platform based on Android Gradle Transform API and ASM. 字节码插件开发平台
Apache License 2.0
3.15k stars 463 forks source link

build.gradle 没有配置 signingConfigs 时构建失败 #155

Closed drumge closed 1 year ago

drumge commented 1 year ago

失败堆栈如下:

Caused by: java.lang.NullPointerException
    at com.bytedance.android.plugin.internal.SigningConfigResolutionKt.getSigningConfigByAppVariant(SigningConfigResolution.kt:37)
    at com.bytedance.android.plugin.internal.SigningConfigResolutionKt.getSigningConfigForAGP4(SigningConfigResolution.kt:33)
    at com.bytedance.android.plugin.internal.SigningConfigResolutionKt.getSigningConfig(SigningConfigResolution.kt:23)
    at com.bytedance.android.plugin.tasks.AabResGuardTask.execute(AabResGuardTask.kt:48)
image

SigningConfig 这个定义看,storeFile 等字段都是可以为null,是不是可以理解为设计上允许不设置 signingConfigs 的,但是 SigningConfigResolution#getSigningConfigByAppVariant中的 variant.signingConfig 是可能会为 null 的, gradle api 可能为null的部分代码如下

    @Override
    public SigningConfig getSigningConfig() {
        return readOnlyObjectProvider.getSigningConfig(
                component.getVariantDslInfo().getSigningConfig());
    }
    @Nullable
    public SigningConfig getSigningConfig(@Nullable SigningConfig signingConfig) {
        if (signingConfig == null) {
            return null;
        }

        SigningConfig readOnlySigningConfig = this.readOnlySigningConfig.get(signingConfig);
        if (readOnlySigningConfig == null) {
            this.readOnlySigningConfig.put(signingConfig,
                    readOnlySigningConfig = new ReadOnlySigningConfig(signingConfig));
        }

        return readOnlySigningConfig;
    }
yangzhiqian commented 1 year ago

这个应该是字节的aabresguard插件的问题?和bytex不是一个插件

drumge commented 1 year ago

这个应该是字节的aabresguard插件的问题?和bytex不是一个插件

是的,抱歉,提错地方了