How to resolve build.gradle errors in flutter. How to resolve this error "A problem occurred evaluating project ':app'. > Malformed \uxxxx encoding."
Solution 1
in you key.properties file, instead of storeFile= C:\Users<username>\upload-keystore.jks
use this storeFile= C:/Users/username/upload-keystore.jks
replace \
with /
in file path.
this will resolve the error if this is the case.
Solution 2
In key.properties
file while completing keystorepath storeFile=path to file
use "/" instead of "\" for subdirectories
i.e. if path is C:/user/[username]/keystore.jks
(path shown in Windows) change it to C:\user\[username]\keystore.jks
.
Abhishek3301
Updated on December 29, 2022Comments
-
Abhishek3301 over 1 year
There's an error in build file. I tried everything but nothing worked getting this errorFAILURE: Build failed with an exception.
-
Where: Build file 'D:\Flutter App\covid19\android\app\build.gradle' line: 31
-
What went wrong: A problem occurred evaluating project ':app'.
Malformed \uxxxx encoding.
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
Get more help at https://help.gradle.org
BUILD FAILED in 6s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 7.4s Gradle task assembleRelease failed with exit code 1
build.gradle file in android folder
''' buildscript { ext.kotlin_version = '1.3.50' repositories { google() jcenter() } dependencies { classpath 'com.android.tools:r8:2.1.75' classpath 'com.google.gms:google-services:4.3.2' classpath 'com.android.tools.build:gradle:4.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() jcenter() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir } '''
build.gradle file in android app folder
tried all possible changes in this file also but didn't worked pls suggest some changes.
''' 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)) } android { compileSdkVersion 28 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.abhishekbhamare.covid19" minSdkVersion 16 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } '''
Thanks in advance
P.S. This is my first ever post on stack overflow so if there are any mistakes in the post format then pls ignore and my apologies for that.
-