0

I have this error: Error

I think its happening because my SDK hasn't appcompat-v7:27.0.1 version. I dont know how add this version to my SDK. I need help!

My appcompat-v7 folder

I paste relevant code below. If you see the error elsewhere, tell me please!:

/app/build.gradle

  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.1"

      defaultConfig {
          applicationId "com.reactnavigationdrawer"
          minSdkVersion 16
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
          ndk {
              abiFilters "armeabi-v7a", "x86"
          }
      }
      ...
 }
  dependencies {
      compile project(':react-native-vector-icons')
      compile fileTree(dir: "libs", include: ["*.jar"])
      compile "com.android.support:appcompat-v7:27.0.1"
      compile "com.facebook.react:react-native:+"  // From node_modules
      compile 'com.facebook.android:facebook-android-sdk:+'
  }

build.gradle

  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
      }
  }

  allprojects {
      repositories {
          mavenLocal()
          jcenter()
          mavenCentral()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url "$rootDir/../node_modules/react-native/android"
          }
      }
  }
Diego Barranco
  • 89
  • 1
  • 2
  • 9
  • Support library should not use a different version than the compileSdkVersion 23. Use ` com.android.support:appcompat-v7:23.0'` – ADM Jan 24 '18 at 13:23
  • if I change compileSdkVersion to 27 the error continues because in my SKD dont find appcompat:27.0.1 version. I need to know how to add it. – Diego Barranco Jan 24 '18 at 13:28

2 Answers2

0

Please clarify your issue,
If your compileSdkVersion is 23, You can not add that dependency.
Try one of these:
1. Install SDK Plaform 27 by selecting Tool > Android > SDK Manager> check Android API 27. next switch to SDK Tool>Show Package Details check one of the sdk build-tools version 27 and Apply
Then edit build.gradle: change compileSdkVersion to compileSdkVersion 27. You should also change buildToolsVersion to "27.x.x" for example is buildToolsVersion '27.0.3'
OR
2. Try compile dependency com.android.support:appcompat-v7:27.0.1 to the version you are having.

You may want to see something here Android studio failed to build tools after updating to 3.0 from 2.3 stable channel

-1

I answered it with the next config:

/app/build.gradle

     android {
      compileSdkVersion 27
      buildToolsVersion "27.0.1"

      defaultConfig {
          applicationId "com.reactnavigationdrawer"
          minSdkVersion 16
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
          ndk {
              abiFilters "armeabi-v7a", "x86"
          }
      }
      signingConfigs {
         release {
             storeFile file(MYAPP_RELEASE_STORE_FILE)
             storePassword MYAPP_RELEASE_STORE_PASSWORD
             keyAlias MYAPP_RELEASE_KEY_ALIAS
             keyPassword MYAPP_RELEASE_KEY_PASSWORD
         }
     }
     ...
    dependencies {
      compile project(':react-native-vector-icons')
      compile fileTree(dir: "libs", include: ["*.jar"])
      compile "com.android.support:appcompat-v7:+"
      compile "com.facebook.react:react-native:+"  // From node_modules
      compile(project(':react-native-fbsdk')) {
       exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
      }
      compile('com.facebook.android:facebook-android-sdk:4.22.1')
   }

build.gradle

  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
      }
  }

  allprojects {
      repositories {
          mavenLocal()
          jcenter()
          mavenCentral()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url "$rootDir/../node_modules/react-native/android"
          }
          maven {url"https://maven.google.com"}
          configurations.all {
              resolutionStrategy {
                  force 'com.facebook.android:facebook-android-sdk:4.22.1'
              }
          }
      }
  }

Dont forget add string.xml and its corresponding in AndroidManifest.xml before executing:

cd android

gradlew clean

cd ..

react-native run-android

Community
  • 1
  • 1
Diego Barranco
  • 89
  • 1
  • 2
  • 9