gradle 错误:无法使字段成为私有的final java.lang.String java.io.File.path可访问:模块java.base不会向未命名的模块“打开java.io“

r1zk6ea1  于 12个月前  发布在  Java
关注(0)|答案(1)|浏览(156)

我是新的Flutter,并试图修复一个问题,我继承了一个应用程序.我能够建立和运行这个应用程序,然后改变了.不知道是什么,但我一直得到这个错误,当我在调试模式下运行应用程序.
完整的错误是:任务“:app:processLoggMainManifest”执行失败。
无法使字段成为私有的final java.lang.String java.io.File.path可访问:模块java.base不会向未命名的模块“打开java.io“
从我在谷歌上搜索的结果来看,似乎我的Java版本是错误的。然而,我已经尝试了几个不同的Java版本,我仍然得到相同的错误。
以下是细节。
操作系统:Windows 11 IDE:Andriod Studio Giraffe - 2022.3.1 Flutter version:2.10.5 Java Versions I have tried:Eclipse Temurin version 1.8.0_382 Oracle OpenJDK version 11 JetBrains Java version 17.0.6
build.gradle

buildscript {
    ext {
        kotlin_version = '1.5.31'
        compileSdkVersion = 32
        targetSdkVersion = 32
        minSdkVersion = 23
        appCompatVersion = "1.4.1"
        playServicesLocationVersion = "19.0.1"
    }

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.8'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            // [required] flutter_background_geolocation
            url "${project(':flutter_background_geolocation').projectDir}/libs"
        }
        maven {
            // [required] background_fetch
            url "${project(':background_fetch').projectDir}/libs"
        }
    }
}

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

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

字符串
app\build.gradle

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 Exception("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'
}

Project background_geolocation = project(':flutter_background_geolocation')

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply from: "${background_geolocation.projectDir}/background_geolocation.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "com.integragroup.deliverytrack.mobile"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

        ndk {
            abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
        }
    }

    signingConfigs {
        release {
            storeFile file('../Signing/Integra')
            storePassword "f1dalg0"
            keyAlias "Integra"
            keyPassword "f1dalg0"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            shrinkResources false
            proguardFiles "${background_geolocation.projectDir}/proguard-rules.pro"
        }
        debug {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'com.google.firebase:firebase-crashlytics:18.2.8'
    implementation 'com.google.firebase:firebase-analytics:20.1.0'
}


gradle-wrapper.properties

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
android.useAndroidX=true
android.enableJetifier=true


如有任何帮助,我们将不胜感激。
我试着用Java版本构建:Eclipse Temurin版本1.8.0_382 Oracle OpenJDK版本11 JetBrains版本17.0.6
我尝试使用Gradle 4.1.3构建
还尝试使用gradle-7.3-all.zip构建

i5desfxk

i5desfxk1#

步骤1文件->项目结构. x1c 0d1x
setp 2选择jdk1.8

相关问题