【问题标题】:Buidling Android Apps requires to update to the latsets version of the Gradle Plugin构建更新到最新版本的 Gradle 插件所需的 Android 应用程序
【发布时间】:2019-11-26 04:21:33
【问题描述】:

我目前正在 React Native (Android Studio) 中构建一个应用程序现在我想生成一个 APK 文件来查看它在我的手机上的外观。 (模拟器工作正常)但我也想在我的手机上看到它。

每次我想构建 -> 构建捆绑包时,我都会收到 Gradle 插件错误。所以我不能继续

我已经升级了 React native 中的 gradle,我已经升级了 android Studio,并且在表单和堆栈上搜索了很多,没有任何答案。

[项目根目录]/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

    } }

[项目根目录]/android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:3.4.2')

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
    }
}

还是出现同样的错误

【问题讨论】:

  • 您是否将 gradle-wrapper.properties 文件更新到最新版本?
  • 这就是我所拥有的:distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=services.gradle.org/distributions/gradle-4.10-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
  • 根据此信息link,您应该在属性中使用5.1.1 zip 版本。把它放在你的 gradle 属性中 distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 而不是 4.10
  • 改了,还是一样的错误
  • 重启笔记本电脑有帮助吗?

标签: android-studio react-native android-gradle-plugin


【解决方案1】:

在你APP Modle.Gradle 尝试替换此行

类路径'com.android.tools.build:gradle:3.4.2' 类路径'com.android.tools.build:gradle:3.2.1'

【讨论】:

  • 那是哪个文件?我还是个新手
猜你喜欢
  • 1970-01-01
  • 2021-11-30
  • 2015-07-19
  • 2019-08-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-09
相关资源
最近更新 更多