maxkomarychev / react-native-ultimate-config

Config that works
MIT License
260 stars 31 forks source link

RN issue: Cannot choose between the following variants of com.facebook.react:react-native #115

Closed esalaza closed 1 year ago

esalaza commented 1 year ago

Describe the bug

Please see https://github.com/facebook/react-native/issues/35210 for the full explanation. The suggested fix in this case would be to bump the react-native dependency to: 0.64.4 (https://github.com/facebook/react-native/releases/tag/v0.64.4)

Steps to Reproduce

nvm install lts/hydrogen
nvm use lts/hydrogen
npm uninstall -g react-native-cli @react-native-community/cli
npx react-native init AwesomeProject
cd AwesomeProject
npx react-native start
npx react-native run-android

The app should launch without issues. Stop Metro. Kill the App. Then

npm i react-native-ultimate-config
npx react-native start
npx react-native run-android

And you should get something like

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/.../AwesomeProject/node_modules/react-native-ultimate-config/android/build.gradle' line: 113

* What went wrong:
A problem occurred configuring project ':react-native-ultimate-config'.
> Could not resolve all files for configuration ':react-native-ultimate-config:implementation'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :react-native-ultimate-config
      > Cannot choose between the following variants of com.facebook.react:react-native:0.70.5:
          - debugVariantDefaultRuntimePublication
          - releaseVariantDefaultRuntimePublication
        All of them match the consumer attributes:
          - Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.5:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
          - Variant 'releaseVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.5:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it

Expected behavior

The app should continue running without issues.

OS

Thank you for this awesome tool :)

esalaza commented 1 year ago

This is actually a duplicate of #107.

JeremyBradshaw7 commented 1 year ago

Is this issue sporadic? I did a build successfully earlier today, but now cannot get past this error.

maxkomarychev commented 1 year ago

There was a massive refactoring made to the library and this problem could have been fixed in a new version 4.1.0-alpha.0 (https://github.com/maxkomarychev/react-native-ultimate-config/pull/128)

Please give it a try!! Thank you!

maxkomarychev commented 1 year ago

I'm going to close this ticket for now. Please feel free to reopen it if issue persists in the most recent version. Thank you!