maxkomarychev / react-native-ultimate-config

Config that works
MIT License
260 stars 31 forks source link

Cannot choose between the following variants of com.facebook.react:react-native:0.70.6: #123

Closed HenryLee2703 closed 1 year ago

HenryLee2703 commented 1 year ago

Describe the bug

Android Studio can not build gradle with new version of React native

Steps to Reproduce

Expected behavior

Build successful and no have error occurs

Stacktraces, logs, screenshots

Screen Shot 2023-01-02 at 22 14 49

Environment

Integration option

Env file

Example of env file that is causing problems

❗PROVIDE EXAMPLE OF ENV FILE
the same example in library instructions setting

OS

Packages

Run react-native info and post below:

 Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/Users/mac/Documents/Working/diagrammobile/node_modules/react-native-reanimated/android/react-native-reanimated-70-hermes.aar

> Configure project :react-native-ultimate-config
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/mac/Documents/Working/diagrammobile/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.6:
          - debugVariantDefaultRuntimePublication
          - releaseVariantDefaultRuntimePublication
        All of them match the consumer attributes:
          - Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.6:
              - 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.6:
              - 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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/mac/Documents/Working/diagrammobile/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.6:
          - debugVariantDefaultRuntimePublication
          - releaseVariantDefaultRuntimePublication
        All of them match the consumer attributes:
          - Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.6:
              - 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.6:
              - 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

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

    at makeError (/Users/mac/Documents/Working/diagrammobile/node_modules/execa/index.js:174:9)
    at /Users/mac/Documents/Working/diagrammobile/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/mac/Documents/Working/diagrammobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/Users/mac/Documents/Working/diagrammobile/node_modules/@react-native-community/cli/build/index.js:142:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Let me know if you have any questions. I have a problem with this issues but I can not resolve this with new version react native.

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!