0

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 build server.

productFlavors {
    flavor1 {
        signingConfig signingConfigs.release
    }
    flavor2 {
        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)
proninyaroslav
  • 720
  • 2
  • 7
  • 19
  • I've specified different signing configs for different flavors with Gradle 5.1.1, 5.5.1, and 5.6.4, and haven't run into any issues. Is that your complete `productFlavors` block, or have you omitted things that you have in your actual `build.gradle` file? Which Android Gradle Plugin version are you using? – Michael Dec 21 '21 at 09:03
  • 7.0.4. The point is that I am using key.properties to automate the build on the local PC. Therefore `signingConfigs.release` requires me to specify `storeFile`, password and other things: https://github.com/proninyaroslav/libretrack/blob/master/android/app/build.gradle#L73 . If I specify `signingConfig` as `release` for this flavor it will require the key.properties file on the remote server. – proninyaroslav Dec 21 '21 at 09:07
  • remove `signingConfig null` from your code and then Build apk from `Build -> Build Bundle(s) / APK(s)` this will use debug.keystore to build shareable apk – Shahnawaz Ansari Dec 21 '21 at 09:11
  • 1
    Similar question: https://stackoverflow.com/questions/68813073/ambiguous-method-overloading-for-method-com-android-build-gradle-internal-core-m – Michael Dec 21 '21 at 09:33
  • My flavor is not build in the Studio, but with a regular gradlew script. – proninyaroslav Dec 21 '21 at 09:41
  • @Michael To be honest, I didn't find a solution there. – proninyaroslav Dec 21 '21 at 16:08

0 Answers0