FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.android.support:multidex:2.0.1.
Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/support/multidex/2.0.1/multidex-2.0.1.pom - https://jcenter.bintray.com/com/android/support/multidex/2.0.1/multidex-2.0.1.pom - https://storage.googleapis.com/download.flutter.io/com/android/support/multidex/2.0.1/multidex-2.0.1.pom - https://repo.maven.apache.org/maven2/com/android/support/multidex/2.0.1/multidex-2.0.1.pom - https://www.jitpack.io/com/android/support/multidex/2.0.1/multidex-2.0.1.pom
Required by: project :app
and this error also when trying to fix this issue with multiple suggestion given by StackOverflow
Could not determine the dependencies of task ':app:lintVitalRelease'. > Could not resolve all artifacts for configuration ':app:debugCompileClasspath'. > Could not find com.android.support:multidex:2.0.1. Required by: project :app
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))
}
android {
compileSdkVersion 31
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 "co.demo.flutter"
minSdkVersion 19
multiDexEnabled true
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 {
// 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 '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:2.0.1'
implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
}
android\build\gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}
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.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
CodePudding user response:
What worked for me is to change the gradle version in /android/build.gradle
classpath 'com.android.tools.build:gradle:7.1.2'
and Distribution Url
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
Also Change your minSdkVersion to 21
CodePudding user response:
First:- Implement these changes
classpath 'com.android.tools.build:gradle:7.1.2'
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
Second is these:-
Add android:exported="true" in AndroidManifest.xml inside activity tag
And last is this:-
implementation "androidx.multidex:multidex:2.0.1"
CodePudding user response:
you should add this in
android/app/build.gradle
lintOptions { checkReleaseBuilds false }