如何在build.gradle中添加调试符号 [英] How to add debug symbols to build.gradle

查看:828
本文介绍了如何在build.gradle中添加调试符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了Flutter应用程序的android版本.

然后,我创建了一个内部测试版本.它显示警告

此应用程序捆绑包包含本机代码,并且您尚未上传调试信息符号.我们建议您上传一个符号文件以使当机和ANR更易于分析和调试.

基本上,我要做的是根据它们显示的链接在build.gradle文件中添加以下内容.

  android.buildTypes.release.ndk.debugSymbolLevel = {SYMBOL_TABLE |满的 } 

我认为这是他们正在谈论的android/app/build.gradle.

不确定在该文件中的确切位置,我必须添加此行.

有人可以指出在何处添加此行吗?

解决方案

要使用 4.1.2

您还需要为Android Studio安装 ndk和cmake../p>

在您的android build.gradle中,您需要设置android gradle插件版本4.1.2:

  buildscript {...储存库{谷歌()jcenter()}依赖项{classpath'com.android.tools.build:gradle:4.1.2'...} 

然后在android/app build.gradle中添加:

  ...安卓 {...ndkVersion"21.3.6528147"#您会在android studio sdk-manager中看到ndk版本...buildTypes {释放 {...ndk {debugSymbolLevel'SYMBOL_TABLE'}}}} 

随后运行时: flutter build appbundle ,它会在一段时间后以两倍大的appbundle完成.

I have created android build of my Flutter application.

Then I created an internal testing release. It is showing a warning

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.

Basically what I had to do is add following to build.gradle file according to the link they show.

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

I assume it is android/app/build.gradle they are talking about.

Not sure exactly where in that file I have to add this line.

Can someone point out where to add this line?

解决方案

To use the option ndk debugSymbolLevel as written in the docs you need an android gradle plugin 4.1 or later. At the time of writing the lastest 4.1 version is 4.1.2

You will need also to install ndk and cmake for android studio.

In your android build.gradle you need the to set android gradle plugin version 4.1.2:

buildscript {
    ...
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        ...
    }

Then in the android/app build.gradle add:

...
android {
    ...
    ndkVersion "21.3.6528147" # you see the ndk version in the android studio sdk-manager
    ...
    buildTypes {
        release {
            ...
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
        }   
    }
}

when you then run: flutter build appbundle it should finish after a while with an appbundle that is twice the size.

这篇关于如何在build.gradle中添加调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆