2

I am new to flutter and am trying to fix an issue with an app that I inherited. I was able to build and run this app and then something changed. Not sure what, but I keep getting this error when I run the app in debug mode.

The full error is: Execution failed for task ':app:processDebugMainManifest'.

Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module

From what I can tell from googling around is that it appears that I have the wrong Java version. However, I have tried several different Java versions and I still get the same error.

Here are the specifics.

OS: 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 Runtime 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

Any help would be greatly appreciated.

I tried to build with differen Java versions: Eclipse Temurin version 1.8.0_382 Oracle OpenJDK version 11 JetBrains Runtime version 17.0.6

I tried to build with Gradle 4.1.3

Also tried building with gradle-7.3-all.zip

1 Answer 1

1

step 1 File->Project Structure... enter image description here

setp 2 select jdk1.8 enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.