React-native-fast-image: Could not find any version that matches com.android.support:support-v4:27.+

Created on 3 May 2018  路  10Comments  路  Source: DylanVann/react-native-fast-image

In the current version (4.0.8), after I added the project and linked it (automatically or manually), the compilation always fails with the following message:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-fast-image'.
> Could not resolve all dependencies for configuration ':react-native-fast-image:_debugPublishCopy'.
   > Could not find any version that matches com.android.support:support-v4:27.+.
     Versions that do not match:
         26.0.0-alpha1
         25.3.1
         25.3.0
         25.2.0
         25.1.1
         + 32 more
     Searched in the following locations:
         file:/C:/Users/User/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml
         file:/C:/Users/User/path/android/sdk-manager/com/android/support/support-v4/maven-metadata.xml
         file:/C:/Users/User/path/android/sdk-manager/com/android/support/support-v4/
     Required by:
         MyProject:react-native-fast-image:unspecified

My android/app/build.gradle, has the following settings:

    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.myproject"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 10
        versionName "0.0.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

Even though the build.gradle of react-native-fast-image has code that gets the sdk versions from the root-project (def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 27) it does somehow not work.

Most helpful comment

You could add the following to android/build.gradle:

project.ext {
    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    minSdkVersion = 16
    targetSdkVersion = 22
}

But I'm wondering if I missed something on the way that I need this workaround which is not documented here.

All 10 comments

@acuntex I am having the same issue. Is there any update on this?

You could add the following to android/build.gradle:

project.ext {
    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    minSdkVersion = 16
    targetSdkVersion = 22
}

But I'm wondering if I missed something on the way that I need this workaround which is not documented here.

I think the sub-project has to have a default version if things aren't defined in the top level project.

react-native-maps does this extension differently than react-native-fast-image. I wonder if their method would generally work better.

https://github.com/react-community/react-native-maps/blob/master/lib/android/build.gradle

adding the settings inside buildscript of android/build.gradle worked for me. thanks @acuntex

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
project.ext {
    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    minSdkVersion = 16
    targetSdkVersion = 22
}

}

The change was made based on this information: https://github.com/facebook/react-native/pull/17741

@DylanVann Makes sense... but who knows when the PR will be closed ;-)

I experienced the same build fail and workaround. I don't suppose we could back-track on that merge until facebook/react-native#17741 catches up?

I'll try with a new project and see how it goes. If it doesn't work then yes something needs to be fixed. Otherwise maybe just an instruction for adding the google() repository (I think that's the change that needs to be made).

https://github.com/facebook/react-native/pull/17741/files#diff-c197962302397baf3a4cc36463dce5eaR21

If you're using support libraries above version 26 you need to use the google() repository.

That's what this answer on SO says at least: https://stackoverflow.com/a/46145933

Yeah I think I jumped the gun a bit on this one. I've reverted the default values to be what is in the current template generated by react-native init.

New release with some notes: https://github.com/DylanVann/react-native-fast-image/releases/tag/v4.0.12

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baba43 picture baba43  路  3Comments

Aligertor picture Aligertor  路  3Comments

banphlet picture banphlet  路  3Comments

mschipperheyn picture mschipperheyn  路  3Comments

kkarmalkar picture kkarmalkar  路  4Comments