Flutter 不包含原生调试符号

Flutter does not include Native Debug Symbols

在 android studio 上使用 flutter 构建我的应用程序,当我上传我的应用程序包(通过 flutter build appbundle 制作时,弹出消息:

Warning

This App Bundle contains native code, and youve not uploaded debug symbols. We recommend you upload a symbol file to make your crashes and ANRs easier to analyze and debug. Learn More

我已经尝试了目前在线的所有解决方案来解决这个问题。以下每个组合:
这些解决方案:

升级到 Flutter 2.10.0
升级到 Android Studio Bumblebee | 2021.1.1 补丁 1 并单击检查更新,它会响应 You already have the latest version of Android Studio and plugins installed.
试图检查 gradle 插件版本,但它被打包到 android studio 中,我看不到版本,也看不到升级选项。
正在将 Android SDK 构建工具升级到 33-rc1。通过 SDK 管理器
通过 SDK 管理器安装 NDK(并行)
通过 SDK 管理器安装 CMake
ndk.dir=/home/jaden/Android/Sdk/ndk/23.1.7779620 添加到 local.properties 文件,尽管这显然已被弃用。 将 android.buildTypes.release.ndk.debugSymbolLevel = 'SYMBOL_TABLE' 添加到我的 app/build.gradle.
的底部 来自 app/build.gradle:

android {
    compileSdkVersion 31

    ...

    defaultConfig {
        applicationId "app.(myapp)"
        minSdkVersion 23
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    ndkVersion "23.1.7779620"
    buildTypes {
        ...
        release {
            signingConfig signingConfigs.release
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
        }
    }
}

扑博士:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on Manjaro Linux 5.13.19-2-MANJARO, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[!] Connected device
    ! No devices available
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.

flutter build appbundle -v 的最后几行:

[        ] > Task :package_info_plus:generateReleaseBuildConfig UP-TO-DATE
[        ] > Task :package_info_plus:parseReleaseLocalResources UP-TO-DATE
[        ] > Task :package_info_plus:generateReleaseRFile UP-TO-DATE
[        ] > Task :package_info_plus:javaPreCompileRelease UP-TO-DATE
[        ] > Task :package_info_plus:compileReleaseJavaWithJavac UP-TO-DATE
[        ] > Task :package_info_plus:mergeReleaseGeneratedProguardFiles UP-TO-DATE
[        ] > Task :package_info_plus:exportReleaseConsumerProguardFiles UP-TO-DATE
[        ] > Task :fluttertoast:compileReleaseAidl NO-SOURCE
[        ] > Task :fluttertoast:generateReleaseBuildConfig UP-TO-DATE
[        ] > Task :fluttertoast:parseReleaseLocalResources UP-TO-DATE
[        ] > Task :fluttertoast:generateReleaseRFile UP-TO-DATE
[        ] > Task :fluttertoast:compileReleaseKotlin UP-TO-DATE
[        ] > Task :fluttertoast:javaPreCompileRelease UP-TO-DATE
[        ] > Task :fluttertoast:compileReleaseJavaWithJavac UP-TO-DATE
[  +97 ms] > Task :fluttertoast:mergeReleaseGeneratedProguardFiles UP-TO-DATE
[        ] > Task :fluttertoast:exportReleaseConsumerProguardFiles UP-TO-DATE
[        ] > Task :permission_handler:compileReleaseAidl NO-SOURCE
[        ] > Task :permission_handler:generateReleaseBuildConfig UP-TO-DATE
[        ] > Task :permission_handler:parseReleaseLocalResources UP-TO-DATE
[        ] > Task :permission_handler:generateReleaseRFile UP-TO-DATE
[        ] > Task :permission_handler:javaPreCompileRelease UP-TO-DATE
[        ] > Task :permission_handler:compileReleaseJavaWithJavac UP-TO-DATE
[        ] > Task :permission_handler:mergeReleaseGeneratedProguardFiles UP-TO-DATE
[        ] > Task :permission_handler:exportReleaseConsumerProguardFiles UP-TO-DATE
[        ] > Task :app:buildKotlinToolingMetadata UP-TO-DATE
[        ] > Task :app:checkReleaseDuplicateClasses UP-TO-DATE
[        ] > Task :app:compileReleaseAidl NO-SOURCE
[        ] > Task :app:generateReleaseBuildConfig UP-TO-DATE
[        ] > Task :cloud_firestore:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :file_picker:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :firebase_auth:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :firebase_core:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :flutter_fimber:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :flutter_inappwebview:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :flutter_plugin_android_lifecycle:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :fluttertoast:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :image_picker:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :package_info_plus:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :path_provider_android:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :permission_handler:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :share_plus:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :shared_preferences_android:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :url_launcher_android:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :webview_flutter_android:writeReleaseAarMetadata UP-TO-DATE
[        ] > Task :app:checkReleaseAarMetadata UP-TO-DATE
[ +495 ms] > Task :app:copyFlutterAssetsRelease
[        ] > Task :app:processReleaseManifestForPackage UP-TO-DATE
[        ] > Task :app:processReleaseResources UP-TO-DATE
[        ] > Task :cloud_firestore:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :file_picker:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :firebase_auth:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :flutter_fimber:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :flutter_inappwebview:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :fluttertoast:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :image_picker:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :package_info_plus:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :path_provider_android:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :permission_handler:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :share_plus:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :shared_preferences_android:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :url_launcher_android:bundleLibCompileToJarRelease UP-TO-DATE
[        ] > Task :webview_flutter_android:bundleLibCompileToJarRelease UP-TO-DATE
[  +96 ms] > Task :app:compileReleaseKotlin UP-TO-DATE
[        ] > Task :app:javaPreCompileRelease UP-TO-DATE
[        ] > Task :app:compileReleaseJavaWithJavac UP-TO-DATE
[        ] > Task :app:extractProguardFiles UP-TO-DATE
[        ] > Task :app:mergeReleaseGeneratedProguardFiles UP-TO-DATE
[        ] > Task :app:processReleaseJavaRes NO-SOURCE
[        ] > Task :cloud_firestore:processReleaseJavaRes NO-SOURCE
[        ] > Task :cloud_firestore:bundleLibResRelease NO-SOURCE
[        ] > Task :file_picker:processReleaseJavaRes NO-SOURCE
[        ] > Task :file_picker:bundleLibResRelease NO-SOURCE
[        ] > Task :firebase_auth:processReleaseJavaRes NO-SOURCE
[        ] > Task :firebase_auth:bundleLibResRelease NO-SOURCE
[        ] > Task :firebase_core:processReleaseJavaRes NO-SOURCE
[        ] > Task :firebase_core:bundleLibResRelease NO-SOURCE
[        ] > Task :flutter_fimber:processReleaseJavaRes NO-SOURCE
[        ] > Task :flutter_fimber:bundleLibResRelease UP-TO-DATE
[        ] > Task :flutter_inappwebview:processReleaseJavaRes NO-SOURCE
[        ] > Task :flutter_inappwebview:bundleLibResRelease NO-SOURCE
[        ] > Task :flutter_keyboard_visibility:processReleaseJavaRes NO-SOURCE
[        ] > Task :flutter_keyboard_visibility:bundleLibResRelease NO-SOURCE
[        ] > Task :flutter_plugin_android_lifecycle:processReleaseJavaRes NO-SOURCE
[        ] > Task :flutter_plugin_android_lifecycle:bundleLibResRelease NO-SOURCE
[        ] > Task :fluttertoast:processReleaseJavaRes NO-SOURCE
[        ] > Task :fluttertoast:bundleLibResRelease UP-TO-DATE
[        ] > Task :image_picker:processReleaseJavaRes NO-SOURCE
[        ] > Task :image_picker:bundleLibResRelease NO-SOURCE
[        ] > Task :package_info_plus:processReleaseJavaRes NO-SOURCE
[        ] > Task :package_info_plus:bundleLibResRelease NO-SOURCE
[        ] > Task :path_provider_android:processReleaseJavaRes NO-SOURCE
[        ] > Task :path_provider_android:bundleLibResRelease NO-SOURCE
[        ] > Task :permission_handler:processReleaseJavaRes NO-SOURCE
[        ] > Task :permission_handler:bundleLibResRelease NO-SOURCE
[        ] > Task :share_plus:processReleaseJavaRes NO-SOURCE
[        ] > Task :share_plus:bundleLibResRelease NO-SOURCE
[        ] > Task :shared_preferences_android:processReleaseJavaRes NO-SOURCE
[        ] > Task :shared_preferences_android:bundleLibResRelease NO-SOURCE
[        ] > Task :url_launcher_android:processReleaseJavaRes NO-SOURCE
[        ] > Task :url_launcher_android:bundleLibResRelease NO-SOURCE
[        ] > Task :webview_flutter_android:processReleaseJavaRes NO-SOURCE
[        ] > Task :webview_flutter_android:bundleLibResRelease NO-SOURCE
[        ] > Task :app:mergeReleaseJavaResource UP-TO-DATE
[        ] > Task :cloud_firestore:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :file_picker:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :firebase_auth:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :firebase_core:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :flutter_fimber:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :flutter_inappwebview:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :flutter_plugin_android_lifecycle:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :fluttertoast:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :image_picker:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :package_info_plus:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :path_provider_android:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :permission_handler:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :share_plus:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :shared_preferences_android:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :url_launcher_android:bundleLibRuntimeToJarRelease UP-TO-DATE
[        ] > Task :webview_flutter_android:bundleLibRuntimeToJarRelease UP-TO-DATE
[ +172 ms] > Task :app:minifyReleaseWithR8 UP-TO-DATE
[        ] > Task :app:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :cloud_firestore:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :cloud_firestore:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :cloud_firestore:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :file_picker:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :file_picker:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :file_picker:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :firebase_auth:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :firebase_auth:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :firebase_auth:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :firebase_core:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :firebase_core:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :firebase_core:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :flutter_fimber:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :flutter_fimber:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :flutter_fimber:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :flutter_inappwebview:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :flutter_inappwebview:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :flutter_inappwebview:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :flutter_keyboard_visibility:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :flutter_plugin_android_lifecycle:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :flutter_plugin_android_lifecycle:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :flutter_plugin_android_lifecycle:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :fluttertoast:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :fluttertoast:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :fluttertoast:copyReleaseJniLibsProjectOnly UP-TO-DATE
[  +16 ms] > Task :image_picker:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :image_picker:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :image_picker:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :package_info_plus:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :package_info_plus:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :package_info_plus:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :path_provider_android:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :path_provider_android:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :path_provider_android:copyReleaseJniLibsProjectOnly UP-TO-DATE
[  +98 ms] > Task :permission_handler:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :permission_handler:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :permission_handler:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :share_plus:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :share_plus:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :share_plus:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :shared_preferences_android:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :shared_preferences_android:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :shared_preferences_android:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :url_launcher_android:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :url_launcher_android:mergeReleaseNativeLibs NO-SOURCE
[        ] > Task :url_launcher_android:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :webview_flutter_android:mergeReleaseJniLibFolders UP-TO-DATE
[        ] > Task :webview_flutter_android:mergeReleaseNativeLibs NO-SOURCE
[  +98 ms] > Task :webview_flutter_android:copyReleaseJniLibsProjectOnly UP-TO-DATE
[        ] > Task :app:mergeReleaseNativeLibs UP-TO-DATE
[        ] > Task :app:stripReleaseDebugSymbols UP-TO-DATE
[+2799 ms] > Task :app:buildReleasePreBundle
[        ] > Task :cloud_firestore:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :file_picker:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :firebase_auth:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :firebase_core:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :flutter_fimber:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :flutter_inappwebview:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :flutter_keyboard_visibility:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :flutter_plugin_android_lifecycle:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :fluttertoast:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :image_picker:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :package_info_plus:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :path_provider_android:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :permission_handler:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :share_plus:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :shared_preferences_android:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :url_launcher_android:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :webview_flutter_android:prepareReleaseArtProfile UP-TO-DATE
[        ] > Task :app:mergeReleaseArtProfile UP-TO-DATE
[        ] > Task :app:compileReleaseArtProfile UP-TO-DATE
[        ] > Task :app:collectReleaseDependencies UP-TO-DATE
[        ] > Task :app:configureReleaseDependencies UP-TO-DATE
[        ] > Task :app:extractReleaseNativeSymbolTables UP-TO-DATE
[        ] > Task :app:parseReleaseIntegrityConfig UP-TO-DATE
[        ] > Task :app:writeReleaseAppMetadata UP-TO-DATE
[        ] > Task :app:validateSigningRelease UP-TO-DATE
[+3397 ms] > Task :app:packageReleaseBundle
[+4398 ms] > Task :app:shrinkBundleReleaseResources
[+5699 ms] > Task :app:signReleaseBundle
[        ] > Task :app:produceReleaseBundleIdeListingFile
[        ] > Task :app:createReleaseBundleListingFileRedirect
[        ] > Task :app:bundleRelease
[  +96 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[        ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[        ] See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
[        ] BUILD SUCCESSFUL in 36s
[        ] 375 actionable tasks: 11 executed, 364 up-to-date
[ +397 ms] Running Gradle task 'bundleRelease'... (completed in 37.5s)
[  +30 ms] ✓ Built build/app/outputs/bundle/release/app-release.aab (68.2MB).
[   +5 ms] "flutter appbundle" took 39,072ms.
[ +235 ms] ensureAnalyticsSent: 224ms
[   +5 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +3 ms] exiting with code 0

building and releasing an android app says absolutely nothing about including native debug symbols. That leads me to believe that for some reason, flutter should already be including them in the app bundle, but it's not. Does it have anything to do with 的 flutter 文档太疯狂了?我没有混淆我的,但我是否需要使用其中描述的解决方案来提取本机调试符号?
这甚至受支持吗?我是否应该按原样上传没有该功能的应用程序?当我收到莫名其妙的崩溃报告时我该怎么办?

由于某种原因,由于我使用了 gradle 插件 7.1.1,问题出现了。将 classpath 'com.android.tools.build:gradle:7.1.1' 更改为 'classpath 'com.android.tools.build:gradle:4.1.3'` 解决了我的问题。 google 播放控制台识别应用程序包中的本机调试符号。目前还不清楚为什么,除了在应用程序包中,目录 BUNDLE-METADATA 包含目录:
使用 7.1.1:

com.android.tools.build.gradle
com.android.tools.build.libraries
com.android.tools.build.obfuscation

使用 4.1.3:

com.android.tools.build.debugsymbols
com.android.tools.build.libraries
com.android.tools.build.obfuscation

我试过androidgradle插件的多个版本,我可以说问题出现在androidgradle插件版本4.1之后。 3.所以我现在的解决方法是让 android/build.gradle 有:

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        ...
    }
}

插件的下一个版本 4.2.0 省略了本机调试文件,尽管 app/build 中包含了这些文件。gradle:

android {
    ...
    packagingOptions {
        dex {
            useLegacyPackaging true
        }
        jniLibs {
            useLegacyPackaging true
        }
    }
}