This is part of the log I got:
**`FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:app:dexBuilderDebug’.
There was a failure while executing work items
A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
> Failed to process: C:Users[USER]projetobuildapptmpkotlin-classesdebug, C:Users[USER]projetobuildappintermediatesjavacdebugclasses`**
This is my project’s android/build.gradle file:
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
This is my project’s android/app/build.gradle file:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace 'com.example.application'
ndkVersion "25.2.9519653"
compileSdkVersion flutter.compileSdkVersion
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.fahad.app"
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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
}
}
}
flutter {
source '../..'
}
I tried to make some modifications on android/app/build.gradle, cleaning flutter cache, and rebuilding the project but I got another error.
FAILURE: Build failed with an exception.
*** What went wrong:
A problem occurred configuring root project ‘android’.
Could not resolve all files for configuration ‘:classpath’.
Could not find com.android.tools.build:gradle:7.6.1.
Searched in the following locations:
– https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.6.1/gradle-7.6.1.pom
– https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.6.1/gradle-7.6.1.pom
Required by:
project :**
This is my updated android/app/build.gradle file:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace 'com.example.application'
ndkVersion "25.2.9519653"
compileSdkVersion flutter.compileSdkVersion
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.fahad.app"
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
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_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
}
flutter {
source '../..'
}
user25578484 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.