如何解决 android\build.gradle 文件的 project.evaluationDependsOn(':app') 行中的错误

Riy*_*ya 7 android-studio build.gradle flutter arcore

这是我的 android\build.gradle 文件

 buildscript {
    ext.kotlin_version = '1.2.41'
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.ar.sceneform:plugin:1.13.0'
    }
}

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

这是我的 app\build.gradle 文件

package example.android.app

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.ar.sceneform.plugin'

android {
    compileSdkVersion 29
    buildToolsVersion "23.0.2"

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.riya.ar_3d_object"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

sceneform.asset('sampledata/Andy.obj',
        'default',
        'sampledata/Andy.sfa',
        'src/main/assets/andy')

sceneform.asset('sampledata/TocoToucan.obj',
        'default',
        'sampledata/TocoToucan.sfa',
        'src/main/assets/toucan')

sceneform.asset('sampledata/ArcticFox_Posed.obj',
        'default',
        'sampledata/ArcticFox_Posed.sfa',
        'src/main/assets/artic_fox')

sceneform.asset('sampledata/fox_face.fbx',
        'sampledata/fox_face_material.mat',
        'sampledata/fox_face.sfa',
        'src/main/assets/fox_face')
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

失败:构建失败并出现异常。

  • 其中:构建文件'C:\ Users \ Dell \ Desktop \ ar_3d_object \ example \ android \ build.gradle'行:27

  • 出了什么问题:评估根项目“android”时出现问题。

配置项目“:app”时出现问题。无法打开 auh9gocscmxbp0wg79n65tthz 的 cp_proj 重新映射类缓存 (C:\Users\Dell.gradle\caches\5.1.1\scripts-remapped\build_23qoew63m1vj2i2ymjivjusak\auh9gocscmxbp0wg79n65tthz\cp_proj13bba240a07c 562d578336deed5b2fbf)。> 无法打开构建文件 'C:\Users\Dell\Desktop\ar_3d_object\example\android\app\build.gradle' 的 cp_proj 通用类缓存 (C:\Users\Dell.gradle\caches\5.1.1\scripts \auh9gocscmxbp0wg79n65tthz\cp_proj\cp_proj13bba240a07c562d578336deed5b2fbf)。> 构建文件“C:\Users\Dell\Desktop\ar_3d_object\example\android\app\build.gradle”不应包含 package 语句。