【问题标题】:Flutter Android Build Gradle error configuring root project 'android'?Flutter Android Build Gradle错误配置根项目'android'?
【发布时间】:2019-03-25 09:34:29
【问题描述】:

我在尝试从 Flutter 运行我的 android 项目时遇到以下错误...

`配置根项目“android”时出现问题。

无法为根项目“android”获取未知属性“android” 输入 org.gradle.api.Project.`

这是我的 android/build.gradle 文件...

buildscript {
    ext.kotlin_version = '1.2.51'
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.2, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
//subprojects {
//    project.evaluationDependsOn(':app')
//}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.0.1"
            }
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

    标签: android gradle flutter build.gradle


    【解决方案1】:

    `配置根项目“android”时出现问题。

    无法为根项目“android”获取未知属性“android” 输入 org.gradle.api.Project.`

    错误是due to where you applied the onesignal-gradle-pluginapply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' 行应应用于您的 app/build.gradle 而不是根 build.gradleandroid/build.gradle

    【讨论】:

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