How to build unsigned flavor for F-Droid with Gradle 5.x

To build the unsigned release APK I used signingConfig null in build.gradle as I am using key.properties which is not available on the remote F-Droid build server https://github.com/proninyaroslav/libretrack/blob/master/android/app/build.gradle#L73

productFlavors {
    main {
        signingConfig signingConfigs.release
    }
    fdroid {
        signingConfig null
    }
}

It worked fine in version 4.x. But starting from version 5.x and above, the following error appeared. Is it possible to somehow resolve this conflict? Or is there another way to build? This solution is pretty old, but now it’s not work.

Caused by: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method com.android.build.gradle.internal.dsl.ProductFlavor_Decorated#signingConfig.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
    [interface com.android.build.api.dsl.ApkSigningConfig]
    [interface com.android.build.gradle.internal.dsl.InternalSigningConfig]
    [interface com.android.builder.model.SigningConfig]
    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.lookupMethod(BeanDynamicObject.java:516)
    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:482)
    at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:196)
    at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)
    at org.gradle.internal.extensibility.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:34)
    at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:56)

I’m no dev but I just remove the signingConfig line when it’s needed.

Then it will try to use release config which I overridden (which takes data from key.properties)

You can use the same config for them and we can remove those lines before build.

1 Like

Fine. Can you please tell me which regex will remove? I’m not very good friends with regex :smiley: https://github.com/proninyaroslav/libretrack/blob/master/android/app/build.gradle

We remove signingConfigs by default. https://gitlab.com/fdroid/fdroidserver/-/blob/master/fdroidserver/common.py#L2868

We can remove all signingConfig with sed -i -e '/signingConfig/d' build.gradle manully.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.