Lottie-react-native: FAILURE: Build failed with an exception.

Created on 4 Feb 2019  路  4Comments  路  Source: lottie-react-native/lottie-react-native

Hello,
I'm trying to build my project (Android) after linking lottie-react-native,
Seems that my buildtools version doesnt satisfy version constraints.
I'm getting alot of these errors in console.

  • What went wrong:
    Could not resolve all files for configuration ':lottie-react-native:debugCompileClasspath'.
    > Could not resolve com.android.support:appcompat-v7:27.1.1.
    Required by:
    project :lottie-react-native
    > Cannot find a version of 'com.android.support:appcompat-v7' that satisfies the version constraints:
    Dependency path 'porjectOne:lottie-react-native:unspecified' --> 'com.facebook.react:react-native:0.58.3' --> 'com.android.support:appcompat-v7:28.0.0'
    Dependency path 'porjectOne:lottie-react-native:unspecified' --> 'com.airbnb.android:lottie:2.5.6' --> 'com.android.support:appcompat-v7:27.1.1'
    Constraint path 'porjectOne:lottie-react-native:unspecified' --> 'com.android.support:appcompat-v7' strictly '27.1.1' because of the following reason: debugRuntimeClasspath uses version 27.1.1
    Constraint path 'porjectOne:lottie-react-native:unspecified' --> 'com.android.support:appcompat-v7' strictly '27.1.1' because of the following reason: debugRuntimeClasspath uses version 27.1.1
    Constraint path 'porjectOne:lottie-react-native:unspecified' --> 'com.android.support:appcompat-v7' strictly '27.1.1' because of the following reason: debugRuntimeClasspath uses version 27.1.1
    Constraint path 'porjectOne:lottie-react-native:unspecified' --> 'com.android.support:appcompat-v7' strictly '27.1.1' because of the following reason: debugRuntimeClasspath uses version 27.1.1
    Constraint path 'porjectOne:lottie-react-native:unspecified' --> 'com.android.support:appcompat-v7' strictly '27.1.1' because of the following reason: debugRuntimeClasspath uses version 27.1.1

my buildscript ext is :
{
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}

any workaround this please ?

Most helpful comment

This will also fix it... add to your android/build.gradle

allprojects {
    repositories {
        // ... your other stuff
        configurations.all {
            resolutionStrategy {
                force "com.android.support:appcompat-v7:$supportLibVersion"
            }
        }
    }
}

All 4 comments

Edit use @rgoldiez's fix instead

In node_modules/lottie-react-native/src/android/build.gradle you need to change the dependencies to:

dependencies {
  compileOnly "com.facebook.react:react-native:+"
  implementation "com.airbnb.android:lottie:2.5.6"
  implementation "com.android.support:appcompat-v7:28.0.0" // <- add this line
}

I'm not sure why you need to do that, but that fixed it for me

This will also fix it... add to your android/build.gradle

allprojects {
    repositories {
        // ... your other stuff
        configurations.all {
            resolutionStrategy {
                force "com.android.support:appcompat-v7:$supportLibVersion"
            }
        }
    }
}

@rgoldiez yours is the best solution I've found so far, thanks!

configurations.all {
resolutionStrategy {
force "com.android.support:appcompat-v7:$supportLibVersion"
}
}

It worked but returned this warning:

uses unchecked or unsafe operations.
Recompile with -Xlint:unchecked for details.

Was this page helpful?
0 / 5 - 0 ratings