react-native-maps: Android dependency 'com.android.support:support-v4 error

Is this a bug report?

Yes

Have you read the Installation Instructions?

Yes

Environment

“react”: “^16.3.0-alpha.1”, “react-native”: “0.54.4”, “react-native-maps”: “^0.21.0”

Steps to Reproduce

I followed the steps for adding the react native maps to android and I’m getting the following errors and warning when I try to run react-native run-android command.

Android dependency 'com.android.support:support-v4' has different version for the compile (23.0.1) and runtime (25.2.0) classpath. You should manually set the same version via DependencyResolution

Expected Behavior

Run the project

(Write what you thought would happen.)

Actual Behavior

Getting error:

screen shot 2018-04-03 at 12 43 50

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15

Most upvoted comments

For it’s working after adding this line in app/build.gradle

implementation “com.android.support:support-v4:27.1.1”

@vikrantnegi

This is what worked for me, edit android/app/build.gradle and change version into 24.0.0

dependencies {
    ...
    api "com.android.support:appcompat-v7:24.0.0"
    ...
}

Try this:

  1. Open you project in android studio and wait for it to sync then,
  2. Update build.gradile to this
  • add google() in repositories under buildscripts so it looks like this
repositories {
        jcenter()
        google()
    }
  • update classpath classpath 'com.android.tools.build:gradle:3.1.1'
  1. Update distributionUrl in gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

I also started encountering a similar error when I updates from RN 0.54 -> RN 0.56. The error message however is slightly different:

Conflict with dependency 'com.android.support:support-compat' in project ':react-native-maps'. Resolved versions for compilation (26.1.0) and packageing (25.2.0) differ.

Environment “react-native”: “0.56.0”, “react-native-maps”: “https://github.com/react-community/react-native-maps.git#43f46991f4a5b0dc9ddba9214ab17e0230b9321a

@RajesMca008 in what line exactly do you need to add that?