Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter build Appbundle Error:* What went wrong: A problem occurred evaluating project ':app'

This is the error that I'm getting when I'm trying to run "flutter build appbundle" in terminal. I already search for some solution but none of it has the same error as I get

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\User_Name\Desktop\deploy\bahetra\android\app\build.gradle' line: 31

  • What went wrong: A problem occurred evaluating project ':app'.

Malformed \uxxxx encoding.

This is the code from my "android\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 GradleException("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"

    def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) // line 31
   }

android {
    compileSdkVersion 30

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.bahetra"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
like image 463
Arthizzyy Avatar asked May 10 '21 14:05

Arthizzyy


Video Answer


1 Answers

The issue is in key.properties file. Replace all the backslash in the store location with the forward slash and it should work. Eg:

Update this in key.properties file:

storeFile= C:\Users\<user name>\upload-keystore.jks

to this:

storeFile=C:/Users/<user name>/upload-keystore.jks

like image 62
Shrikant Shetty Avatar answered Sep 20 '22 20:09

Shrikant Shetty