walterholohan / react-native-crisp-chat-sdk

React-Native bridge for Crisp Chat iOS and Android SDK's
MIT License
70 stars 26 forks source link

Targeting Sdk version 31 on android #58

Closed maximewim closed 1 year ago

maximewim commented 2 years ago

Hello ! I'm trying to install this package. But when adding it to my project. I'm getting this error on compilation :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkStagingDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (31) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-30).
     Dependency: androidx.appcompat:appcompat:1.4.1.
     AAR metadata file: C:\Users\maximedev\.gradle\caches\transforms-3\65490f590e300e64121b2eb11f167879\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties. 

Not sure from where it come, the project don't seems to target sdk 31. The only thing I found is that the android sdk sample is targeting 31... Is anybody got the same issue or has a solution ?

iagormoraes commented 2 years ago

Not sure from where it come, the project don't seems to target sdk 31. The only thing I found is that the android sdk sample is targeting 31... Is anybody got the same issue or has a solution ?

@maximewim I had the same issue, by adding the following to android/build.gradle it make to work:

        compileSdkVersion = 31
        targetSdkVersion = 31
maximewim commented 2 years ago

Not sure from where it come, the project don't seems to target sdk 31. The only thing I found is that the android sdk sample is targeting 31... Is anybody got the same issue or has a solution ?

@maximewim I had the same issue, by adding the following to android/build.gradle it make to work:

        compileSdkVersion = 31
        targetSdkVersion = 31

I would prefer not to have to update the build version. This creates other issues related to my project. Is there no other solution?

iagormoraes commented 2 years ago

Not sure from where it come, the project don't seems to target sdk 31. The only thing I found is that the android sdk sample is targeting 31... Is anybody got the same issue or has a solution ?

@maximewim I had the same issue, by adding the following to android/build.gradle it make to work:

        compileSdkVersion = 31
        targetSdkVersion = 31

I would prefer not to have to update the build version. This creates other issues related to my project. Is there no other solution?

@maximewim you can force the module appcompat of group androidx.appcompat to use 1.3.0 instead of 1.4.1, I could make it work to my project, can share with you the configuration later.

EDIT: @maximewim here is the force configuration to the package in specific, it will downcrease the module version, put this on android/build.gradle

configurations.all {
    resolutionStrategy {
        eachDependency { details ->
            // Crisp SDK setup
            if (details.requested.group == 'androidx.appcompat') {
              details.useVersion "1.3.0"
            }
        }
    }
}
mickaelcornelli commented 1 year ago

Hi,

I integrated Crisp chat on my React website and would like to implement it on my React Native app.

My React Native app is using the following versions:

 "react-native": "0.70.8",
"expo": "~47.0.12",

I followed the installation steps by running yarn add react-native-crisp-chat-sdk and configuring the app.json file with the plugin as follows: yarn add react-native-crisp-chat-sdk

 {
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ],
      [
        "react-native-crisp-chat-sdk",
        {
          "websiteId": "YOUR_WEBSITE_ID"
        }
      ]
    ]
  }
}

However, I encountered the same issue as mentioned in a previous answer in this topic with the SDK version.

1.  Dependency 'androidx.appcompat:appcompat-resources:1.5.1' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 32.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       2.  Dependency 'androidx.appcompat:appcompat:1.5.1' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 32.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       3.  Dependency 'com.google.android.exoplayer:exoplayer:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       4.  Dependency 'androidx.emoji2:emoji2-views-helper:1.2.0' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 32.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       5.  Dependency 'androidx.emoji2:emoji2:1.2.0' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 32.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       6.  Dependency 'com.google.android.exoplayer:exoplayer-dash:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       7.  Dependency 'com.google.android.exoplayer:exoplayer-hls:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       8.  Dependency 'com.google.android.exoplayer:exoplayer-rtsp:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       9.  Dependency 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      10.  Dependency 'com.google.android.exoplayer:exoplayer-core:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      11.  Dependency 'com.google.android.exoplayer:exoplayer-ui:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      12.  Dependency 'com.google.android.exoplayer:exoplayer-datasource:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      13.  Dependency 'com.google.android.exoplayer:exoplayer-database:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      14.  Dependency 'com.google.android.exoplayer:exoplayer-extractor:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      15.  Dependency 'com.google.android.exoplayer:exoplayer-decoder:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

      16.  Dependency 'com.google.android.exoplayer:exoplayer-common:2.18.2' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.2.1 is 32.

           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 33, then update this project to use
           compileSdkVerion of at least 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

When I checked my android/app/build.gradle file, I found the following lines:

minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion

I replaced these lines with versions 32 and 33, respectively, but the issue persisted. I also tried using the following commands:

npx expo prebuild -p android --clean
npx expo run:android

I also tried the suggestion of @iagormoraes

configurations.all {
    resolutionStrategy {
        eachDependency { details ->
            // Crisp SDK setup
            if (details.requested.group == 'androidx.appcompat') {
              details.useVersion "1.3.0"
            }
        }
    }
}

But my configurations.all file is not the same so still try to adapt and test but nothing works

Do you have any suggestions on how to resolve this issue?