【问题标题】:React Native Could not find com.android.support:appcompat-v7:${supportVersion}React Native 找不到 com.android.support:appcompat-v7:${supportVersion}
【发布时间】:2020-02-13 01:56:03
【问题描述】:

我有一个 React Native 应用程序,我正在尝试将其部署到 Windows 10 上的 Android Studio 的 Android 模拟器。

我从提升的 Power Shell 运行应用程序,使用

react-native run-android

Metro Bundler 控制台打开,但构建失败并显示以下消息:

无法解析所有配置文件 ':react-native-audio:debugCompileClasspath'.

找不到 com.android.support:appcompat-v7:${supportVersion}。要求: 项目:react-native-audio

我有:

  • React Native v0.59.10
  • 节点 v10.16.3
  • Android Studio v3.5
  • 分级:

    buildToolsVersion = "28.0.3"

    minSdkVersion = 16

    compileSdkVersion = 28

    targetSdkVersion = 28

    supportLibVersion = "28.0.0"

    类路径'com.android.tools.build:gradle:3.3.1'

我已尝试按照the advice from github 更改为classpath 'com.android.tools.build:gradle:3.2.1',但这只会导致不同的错误:

配置项目 ':app' 时出现问题。

无法为 com.android.build.gradle.internal.api.ApplicationVariantImpl 类型的对象获取未知属性“mergeResourcesProvider”。

【问题讨论】:

    标签: android react-native android-studio gradle


    【解决方案1】:

    试试改成

     classpath 'com.android.tools.build:gradle:3.4.1'
    

    并确保在 gradle/wrapper/gradle-wrapper.properties 中的版本如下

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
    

    【讨论】:

      【解决方案2】:

      按照这个公关,将引号转换为双引号:

      https://github.com/jsierles/react-native-audio/pull/333/files

      dependencies {
          compile fileTree(include: ['*.jar'], dir: 'libs')
          compile 'com.android.support:appcompat-v7:${supportVersion}'
          compile 'com.facebook.react:react-native:+'
      }
      
      // change to
      
      dependencies {
          compile fileTree(include: ['*.jar'], dir: 'libs')
          compile "com.android.support:appcompat-v7:${supportVersion}"
          compile 'com.facebook.react:react-native:+'
      }
      
      
      

      【讨论】:

        猜你喜欢
        • 2017-10-28
        • 2015-10-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-23
        • 1970-01-01
        相关资源
        最近更新 更多