如何将本机代码符号发布到 Google Play 控制台?

Posted

技术标签:

【中文标题】如何将本机代码符号发布到 Google Play 控制台?【英文标题】:How to publish native code symbols to Google Play console? 【发布时间】:2020-12-03 06:38:30 【问题描述】:

我正在尝试将 android 应用程序发布到 Google Play 并收到警告:

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

我在one documentation 中找到了,我应该添加

android.buildTypes.release.ndk.debugSymbolLevel =  SYMBOL_TABLE | FULL 

build.gradle 文件和another documentation 的行,我应该添加

android.defaultConfig.ndk.debugSymbolLevel = 'FULL'

build.gradle 文件的行。

哪个是正确的?

无论如何,两者都不起作用。

如果我将这一行(按原样)添加到 build.gradle(字面上遵循文档),我会收到 Gradle 错误,它无法找到 ndkdebugSymbolLevel 名称。

如果我将该行(按原样)添加到gradle.properties,则它没有任何效果:aab 文件看起来具有相同的大小并且警告仍然存在。

如何实现?

【问题讨论】:

见***.com/a/62574090/504477。可能是 Gradle 版本问题。 【参考方案1】:

这两个选项都可以。如果您使用android.defaultConfig.ndk.debugSymbolLevel,它将应用于所有构建类型(即调试和发布构建)。另一方面,如果您使用android.buildTypes.release.ndk.debugSymbolLevel,它将仅适用于您的发布版本。

这些选项必须添加到您的app/build.gradle 文件中,看起来有点像这样:

android 
    compileSdkVersion 28
    defaultConfig 
        applicationId 'com.example.foo'
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 42
        versionName "4.0.2"
        ndk 
            debugSymbolLevel 'SYMBOL_TABLE'
        
    
    // Rest of the file

HTH

【讨论】:

您好 Alberto,我听从了您的建议,但不幸的是,Play Console 仍然无法在 AAB 中找到调试符号文件。任何想法?谢谢。 这里也一样,不知道为什么。现在真的很生气

以上是关于如何将本机代码符号发布到 Google Play 控制台?的主要内容,如果未能解决你的问题,请参考以下文章

尝试将 apk 上传到 google play 控制台时,我收到错误和警告消息

此版本不符合 Google Play 64 位要求。本机 Java 应用程序的所有 .so 都已存在

此版本符合 Google Play 64 位要求本机应用程序

Google Play 服务库更新和缺少符号 @integer/google_play_services_version

google play store 警告:App Bundle 包含原生代码,建议上传去混淆文件

APK 或 App Bundle 可用于 64 位设备,但它们只有 32 位本机代码 Unity Play 商店错误