本文介绍了如何将appcompat-v7:27.0.1添加到SDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到此错误:错误

我认为是因为我的SDK尚未安装appcompat-v7:27.0.1版本.我不知道如何将此版本添加到我的SDK.我需要帮助!

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!

我的appcompat-v7文件夹

我在下面粘贴相关代码.如果您在其他地方看到错误,请告诉我!:

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

/app/build.gradle

/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

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

推荐答案

我用下一个配置对其进行了回答:

I answered it with the next config:

/app/build.gradle

/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

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

在执行之前,请不要忘记在AndroidManifest.xml中添加string.xml及其对应的内容:

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

gradlew clean

gradlew clean

cd ..

react-native run-android

react-native run-android

这篇关于如何将appcompat-v7:27.0.1添加到SDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:05