build(android): 修复模板覆盖导致的打包失败
- 恢复 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,无需镜像。
This commit is contained in:
@@ -25,8 +25,21 @@ android {
|
||||
// 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 = 1
|
||||
versionName = "1.0.0"
|
||||
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 {
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="清听"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:extractNativeLibs="true">
|
||||
android:foregroundServiceType="mediaPlayback">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
|
||||
@@ -4,3 +4,6 @@ android.useAndroidX=true
|
||||
android.newDsl=false
|
||||
# This builtInKotlin flag was added by the Flutter template
|
||||
android.builtInKotlin=false
|
||||
# 本机 Kotlin 守护进程连不上(fallback 编译),且增量缓存易损坏,沿用 main 分支原有的设置
|
||||
kotlin.incremental=false
|
||||
kotlin.parallel.tasks.in.project=false
|
||||
|
||||
Reference in New Issue
Block a user