Код: Выделить всё
Execution failed for task ':app:mergeDexRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Type io.flutter.plugins.GeneratedPluginRegistrant is defined multiple times: D:\module_test\test_project\build\app\intermediates\proje
ct_dex_archive\release\dexBuilderRelease\out\io\flutter\plugins\GeneratedPluginRegistrant.dex, D:\module_test\test_project\build\app\intermediates\external_libs_dex\release\mergeExtDexRelease\classes.dex
Однажды внутри моего Flutter_release-1.0.aar
и после автоматического генерируемого проекта Flutter
radgrgs. модуль) < /p>
Код: Выделить всё
id("com.android.application")
id("kotlin-android")
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.example.test_project"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
defaultConfig {
applicationId = "com.example.test_project"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
// Enable multidex to handle duplicate classes
multiDexEnabled = true
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("debug")
// Disable R8 for Flutter module compatibility
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
debug {
isMinifyEnabled = false
}
}
sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
}
packaging {
jniLibs {
pickFirsts.add("lib/arm64-v8a/libapp.so")
pickFirsts.add("lib/armeabi-v7a/libapp.so")
pickFirsts.add("lib/x86_64/libapp.so")
pickFirsts.add("lib/x86/libapp.so")
}
}
}
repositories {
flatDir {
dirs("../libs")
}
}
dependencies {
implementation(files("../libs/flutter_release-1.0.aar"))
// Required dependencies for Flutter module
implementation("androidx.lifecycle:lifecycle-common-java8:2.6.2")
implementation("androidx.lifecycle:lifecycle-runtime:2.6.2")
implementation("androidx.fragment:fragment:1.6.1")
implementation("androidx.activity:activity:1.7.2")
// Multidex support
implementation("androidx.multidex:multidex:2.0.1")
}
flutter {
source = "../.."
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... ntegrating