I'm working with a "legacy" app using RNN, and it has in its gradle config a "releaseStaging" and a "releaseProduction" build type, the differences being the signing config and a handful of environment variables. I'm able to build a debug build just fine, and RNN works like it ought on the emulators / simulators. I am, however, trying to build the "releaseStaging" type, and it's not working. I suspect there's some Gradle configuration that I don't know how to work with breaking the build. Specifically, the error I'm getting is that, for each dependency, I get the following message (I just picked the last one, react-native-localize, as an example):
> Could not resolve project :react-native-localize.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-localize:
- Configuration 'debugApiElements':
- Required RNN.reactNativeVersion 'reactNative57_5' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'debugRuntimeElements':
- Required RNN.reactNativeVersion 'reactNative57_5' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required RNN.reactNativeVersion 'reactNative57_5' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'releaseRuntimeElements':
- Required RNN.reactNativeVersion 'reactNative57_5' but no value provided.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
RNN's error message is slightly different:
> Could not resolve project :react-native-navigation.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-navigation:
- Configuration 'reactNative57_5DebugApiElements':
- Required RNN.reactNativeVersion 'reactNative57_5' and found compatible value 'reactNative57_5'.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'reactNative57_5Debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'reactNative57_5DebugRuntimeElements':
- Required RNN.reactNativeVersion 'reactNative57_5' and found compatible value 'reactNative57_5'.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'debug'.
- Found com.android.build.api.attributes.VariantAttr 'reactNative57_5Debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'reactNative57_5ReleaseApiElements':
- Required RNN.reactNativeVersion 'reactNative57_5' and found compatible value 'reactNative57_5'.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'reactNative57_5Release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Configuration 'reactNative57_5ReleaseRuntimeElements':
- Required RNN.reactNativeVersion 'reactNative57_5' and found compatible value 'reactNative57_5'.
- Required com.android.build.api.attributes.BuildTypeAttr 'releaseStaging' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'reactNative57_5Release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
I apologize, I'm not sure how to reproduce this in a "clean" app, and I was wondering if anyone had seen this before.
This was totally not a bug with RNN. But if someone does get here from Google, I fixed it by setting the matchingFallbacks
config option so that my releaseStaging
build type corresponded to release
build types in the dependent projects.
android {
// ...
buildTypes {
releaseStaging {
initWith release
matchingFallbacks = ['release']
// ...
}
releaseProduction {
initWith release
matchingFallbacks = ['release']
// ...
}
}
}
Most helpful comment
This was totally not a bug with RNN. But if someone does get here from Google, I fixed it by setting the
matchingFallbacks
config option so that myreleaseStaging
build type corresponded torelease
build types in the dependent projects.