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
I get the following error:
````
Execution failed for task ':app:transformDexWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/design/widget/CoordinatorLayout$1;
````
Did you include the pro guard rules (if you are using it) referenced in the docs?
Maybe you missed on that, at least I did.
Yep. I don't think we have the same error
I also had this error this morning although the same project had been building correctly a couple of days ago. I opened Android Studio and built the project in there successfully but then got a different error when running react-native run-android from the command line - see issue #279 . Reinstalling the dependencies solved the issue for me:
rm -r node_modules
yarn
react-native link
react-native run-android
If you're not using yarn you could replace the yarn line with npm install.
+1
I also having the mismatch version error, I am using :
compileSdkVersion 23
buildToolsVersion "23.0.1",
react-native : .55.4,
Any update how to resolve that issue?
@tobbbe did u find any solution?
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.
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:
I had exactly the same problem, but my build.gradle already looks like the provided snippet.
Do you have any other idea how to solve this problem?
With 5.0.3 it worked fine, after updating to 5.0.10 it doesn't work anymore ...
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"
}
}
}
}
Most helpful comment
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:In the most recent version of React Native Fast Image (5.0.10) this property is used.