- 恢复 versionCode/versionName 取自 pubspec(模板硬编码为 1/1.0.0) - extractNativeLibs 从 Manifest 移到 packaging.jniLibs.useLegacyPackaging(AGP 9 要求) - 恢复 kotlin.incremental=false / kotlin.parallel.tasks.in.project=false(模板覆盖时丢失) 已用 gradlew assembleDebug 验证:BUILD SUCCESSFUL,APK 内每个 ABI 仅一份 libmpv.so + libmediakitandroidhelper.so。 依赖解析已用 :app:dependencies --refresh-dependencies 验证可直连 Maven Central,无需镜像。
63 lines
2.1 KiB
Kotlin
63 lines
2.1 KiB
Kotlin
plugins {
|
||
id("com.android.application")
|
||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||
id("dev.flutter.flutter-gradle-plugin")
|
||
}
|
||
|
||
android {
|
||
namespace = "com.lxh.qingting_player"
|
||
compileSdk = flutter.compileSdkVersion
|
||
ndkVersion = flutter.ndkVersion
|
||
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_17
|
||
targetCompatibility = JavaVersion.VERSION_17
|
||
}
|
||
|
||
defaultConfig {
|
||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||
applicationId = "com.lxh.qingting_player"
|
||
// You can update the following values to match your application needs.
|
||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||
minSdk = flutter.minSdkVersion
|
||
targetSdk = flutter.targetSdkVersion
|
||
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
|
||
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
|
||
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
|
||
// flag during build.
|
||
versionCode = flutter.versionCode
|
||
versionName = flutter.versionName
|
||
|
||
// 与 main 分支保持一致:仅打包 arm64-v8a
|
||
ndk {
|
||
abiFilters.addAll(listOf("arm64-v8a"))
|
||
}
|
||
}
|
||
|
||
// AGP 9 不再允许在 AndroidManifest 里写 android:extractNativeLibs,
|
||
// 改为在这里声明,效果等价于原先的“强制提取 .so”
|
||
packaging {
|
||
jniLibs {
|
||
useLegacyPackaging = 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.getByName("debug")
|
||
}
|
||
}
|
||
}
|
||
|
||
kotlin {
|
||
compilerOptions {
|
||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||
}
|
||
}
|
||
|
||
flutter {
|
||
source = "../.."
|
||
}
|