snapshot: 存档 flutter create 模板覆盖后的现场,作为多实例修复前的基线
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
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 = 36
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
@@ -14,49 +15,25 @@ android {
|
||||
}
|
||||
|
||||
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 = 34
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
|
||||
// 仅打包 arm64-v8a
|
||||
ndk {
|
||||
abiFilters.addAll(listOf("arm64-v8a"))
|
||||
}
|
||||
}
|
||||
|
||||
// 显式指定 jniLibs 源目录
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
jniLibs.srcDirs("src/main/jniLibs")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Copy> {
|
||||
if (name.startsWith("merge") && name.endsWith("JniLibFolders")) {
|
||||
from("src/main/jniLibs")
|
||||
into("$buildDir/intermediates/merged_jni_libs/debug/out")
|
||||
}
|
||||
}
|
||||
// 打包配置
|
||||
packagingOptions {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
}
|
||||
pickFirsts += "**/*.so"
|
||||
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 = 1
|
||||
versionName = "1.0.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
}
|
||||
|
||||
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")
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,4 +46,4 @@ kotlin {
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-45
@@ -1,45 +0,0 @@
|
||||
# ============================================================
|
||||
# media_kit 核心
|
||||
# ============================================================
|
||||
-keep class com.media_kit.** { *; }
|
||||
-keep class com.alexmercerind.** { *; }
|
||||
-keep class org.mozilla.** { *; }
|
||||
|
||||
# 保留所有 native 方法
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
# 保留所有 JNI 相关
|
||||
-keep class * implements java.lang.reflect.Method { *; }
|
||||
-keep class * extends java.lang.reflect.Method { *; }
|
||||
|
||||
# ============================================================
|
||||
# audio_service 插件
|
||||
# ============================================================
|
||||
-keep class com.ryanheise.audioservice.** { *; }
|
||||
|
||||
# ============================================================
|
||||
# Flutter 核心
|
||||
# ============================================================
|
||||
-keep class io.flutter.** { *; }
|
||||
-keep class io.flutter.plugin.** { *; }
|
||||
-keep class io.flutter.embedding.** { *; }
|
||||
|
||||
# ============================================================
|
||||
# 忽略 Google Play Core 缺失类(如果不想添加依赖)
|
||||
# ============================================================
|
||||
-dontwarn com.google.android.play.core.**
|
||||
-keep class com.google.android.play.core.** { *; }
|
||||
|
||||
# ============================================================
|
||||
# 保留 Serializable 支持
|
||||
# ============================================================
|
||||
-keepclassmembers class * implements java.io.Serializable {
|
||||
static final long serialVersionUID;
|
||||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||
private void writeObject(java.io.ObjectOutputStream);
|
||||
private void readObject(java.io.ObjectInputStream);
|
||||
java.lang.Object writeReplace();
|
||||
java.lang.Object readResolve();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.lxh.qingting_player">
|
||||
|
||||
package="com.lxh.qingting_player"> <!-- ⭐ 改这里 -->
|
||||
<!-- 权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
@@ -15,8 +15,7 @@
|
||||
android:label="清听"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:extractNativeLibs="true"> <!-- ⭐ 强制提取 .so,避免压缩后加载失败 -->
|
||||
|
||||
android:extractNativeLibs="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
@@ -34,8 +33,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- AudioService -->
|
||||
<!-- ⭐ AudioService(不加 meta-data) -->
|
||||
<service
|
||||
android:name="com.ryanheise.audioservice.AudioService"
|
||||
android:exported="true"
|
||||
@@ -45,8 +43,9 @@
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- MediaButtonReceiver -->
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<!-- ⭐ MediaButtonReceiver -->
|
||||
<receiver
|
||||
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
|
||||
android:exported="true">
|
||||
@@ -55,7 +54,7 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- FileProvider for artwork(已配置,保持不变) -->
|
||||
<!-- ⭐ FileProvider -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
@@ -70,12 +69,15 @@
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
||||
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
||||
@@ -16,26 +16,8 @@ class MainActivity : FlutterActivity() {
|
||||
private val CHANNEL = "com.lxh.qingting_player/file_provider"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// ⭐ 强制加载 libmediakitandroidhelper.so,触发 JNI_OnLoad,缓存 JavaVM
|
||||
try {
|
||||
System.loadLibrary("mediakitandroidhelper")
|
||||
Log.d("MainActivity", "✅ libmediakitandroidhelper loaded")
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
Log.e("MainActivity", "❌ libmediakitandroidhelper load failed", e)
|
||||
}
|
||||
|
||||
// ⭐ 可选:预加载 libmpv.so(让系统 linker 也可见,增强兼容性)
|
||||
try {
|
||||
System.loadLibrary("mpv")
|
||||
Log.d("MainActivity", "✅ libmpv loaded")
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
Log.e("MainActivity", "❌ libmpv load failed", e)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
requestAudioFocus()
|
||||
|
||||
setHighRefreshRate()
|
||||
}
|
||||
|
||||
@@ -63,7 +45,7 @@ class MainActivity : FlutterActivity() {
|
||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
|
||||
// FileProvider MethodChannel for sharing artwork via content:// URI
|
||||
// FileProvider MethodChannel
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
||||
.setMethodCallHandler { call, result ->
|
||||
if (call.method == "getContentUri") {
|
||||
|
||||
Reference in New Issue
Block a user