question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missmatching versions of android support lib

See original GitHub issue

After Ive done yarn add react-native-fast-image and react-native link react-native-fast-image I get this error when trying to run my app. It seems like react-native-fast-image uses support-v4/27.1.1 but react-native has another version installed. How can I resolve this?

C:\Utveckling\myapp>react-native run-android
Scanning folders for symlinks in C:\Utveckling\myapp\node_modules (32ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
File C:\Users\myapp\.android\repositories.cfg could not be loaded.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
   > Could not find com.android.support:support-v4:27.1.1.
     Searched in the following locations:
         file:/C:/Users/myapp/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom
         file:/C:/Users/myapp/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar
         file:/C:/Utveckling/myapp/android/sdk-manager/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar
     Required by:
         elkedjan:app:unspecified > com.android.support:appcompat-v7:23.0.1
   > Could not find com.android.support:support-v4:27.1.1.
     Searched in the following locations:
         file:/C:/Users/myapp/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.pom
         file:/C:/Users/myapp/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar
         file:/C:/Utveckling/myapp/android/sdk-manager/com/android/support/support-v4/27.1.1/support-v4-27.1.1.jar
     Required by:
         myapp:app:unspecified > myapp:react-native-fast-image:unspecified

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

BUILD FAILED

Total time: 11.446 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
DylanVanncommented, Sep 23, 2018

If you’re using a recent version of React Native then you can configure the support lib version at the project level in build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

In the most recent version of React Native Fast Image (5.0.10) this property is used.

2reactions
onlybenyangcommented, Oct 30, 2018

try add the code in android/build.gradle:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.0.2"
            }
        }
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Studio, mismatch support library versions error, but ...
Project in Android Studio, and getting this error: com.android.support libraries must use the exact same version specification.
Read more >
Recent Support Library Revisions - Android Developers
This page provides details about the most recent Support Library package releases. For earlier releases, see the Support Library Revisions Archive.
Read more >
Support Library - Android Developers
Support Library Release Versions ... The release version of the Support Library, such as 24.2.0 or 25.0.1, is different from the minimum API...
Read more >
Support Library Packages - Android Developers
The Android Support Library contains several library packages that can be included in your application. Each of these libraries supports a specific range...
Read more >
Support Library Setup - Android Developers
Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found