didomi / react-native

Didomi SDK for React Native
Other
9 stars 2 forks source link

Android app does not compile - problems with com.google.guava:guava #95

Closed fdalmard closed 1 year ago

fdalmard commented 1 year ago

Issue

I created a new project with React Native version 0.66.5 and ran it on an Android emulator. So far so good.

Then I installed the latest Didomi dependency (version 1.21.0) and try to build the Android app again : this result in compilation errors related to com.google.guava:guava

Is is because I'm using React Native version 0.66.5 ? Does Didomi require a minimum version of React Native to work ? 🤔

Steps to reproduce the issue

npx react-native init AwesomeProject --version 0.66.5
cd AwesomeProject/
yarn add @didomi/react-native
npx react-native run-android

Compilation errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.google.guava:guava:32.1.3-android.
     Required by:
         project :app > project :didomi_react-native > io.didomi.sdk:android:1.85.0
      > The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'. However we cannot choose between the following variants of com.google.guava:guava:32.1.3-android:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides a library but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
                  - Provides compatibility with Java 8 but the consumer didn't ask for it
                  - Provides its elements packaged as a jar but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides a library but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides compatibility with Java 8 but the consumer didn't ask for it
                  - Provides its elements packaged as a jar but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
              - Other compatible attribute:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
          - Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
              - Other compatible attribute:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
   > Could not resolve com.google.guava:guava:31.1-android.
     Required by:
         project :app > project :didomi_react-native > io.didomi.sdk:android:1.85.0 > androidx.javascriptengine:javascriptengine:1.0.0-alpha05
      > The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'. However we cannot choose between the following variants of com.google.guava:guava:32.1.3-android:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides a library but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
                  - Provides compatibility with Java 8 but the consumer didn't ask for it
                  - Provides its elements packaged as a jar but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Provides a library but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides compatibility with Java 8 but the consumer didn't ask for it
                  - Provides its elements packaged as a jar but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
              - Other compatible attribute:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
          - Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.3-android and com.google.guava:guava:32.1.3-android:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
              - Other compatible attribute:
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')

* 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
pmerlet-at-didomi commented 1 year ago

Hello @fdalmard , we don't specify a minimum React-Native version for our plugin. The issue you are experiencing was due to the Android native sdk used by the plugin, it will be fixed in a new release very soon.

pmerlet-at-didomi commented 1 year ago

The release 1.22.0 is available, can you confirm if it fixes your issue?

fdalmard commented 1 year ago

Yes, it fixes my issue. Thanks @pmerlet-at-didomi ! 💪