210

When I want to release a new flutter app bundle to the Playstore. I get this error: "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." I can't find any way to fix this. I'm new with flutter and releasing app's and getting a bit desperate... Any help would be fantastic.

When I add "android.defaultConfig.ndk.debugSymbolLevel = 'FULL'" (on line 1) to the app/build.gradle as suggested in https://developer.android.com/studio/preview/features#native-crash-symbolization. I get This error in the Android studio terminal. I use this command "flutter build appbundle".

Error in Terminal: FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\filip\AndroidStudioProjects\ehbo\android\app\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'.

Could not get unknown property 'android' for project ':app' of type org.gradle.api.Project.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s Running Gradle task 'bundleRelease'... Running Gradle task 'bundleRelease'... Done 4,3s Gradle task bundleRelease failed with exit code 1

fleepp
  • 2,103
  • 2
  • 6
  • 4
  • It seems you need to upload deobfuscation / symbolication file . check below link: https://support.google.com/googleplay/android-developer/answer/9848633?hl=en – vinodaw Jun 25 '20 at 09:55
  • 1
    It's just beta problems, this functionality is not in stable gradle release yet, only in 4.1 So looks like Play console beta is for android studio beta now. – Shakle Jun 26 '20 at 08:11

15 Answers15

175

Reproduce next steps and this warning will disapear

  1. Go to [YOUR_PROJECT]\app\build\intermediates\merged_native_libs\release\out\lib

For some the path might be [YOUR_PROJECT]\build\app\.... and not [YOUR_PROJECT]\app\build\.... like mentioned above.

note that 3 folders exist inside

  • arm64-v8a
  • armeabi-v7a
  • x86_64
  1. Select this 3 folder and create a .zip file. Name doesn't matter.

[PLEASE NOTE THAT I HAVEN'T COMPRESSED THE ./lib FOLDER]

  1. Upload this new *.zip file as Symbol File.

.

PhillipJacobs
  • 2,337
  • 1
  • 16
  • 32
skyllet
  • 1,991
  • 2
  • 12
  • 10
  • 29
    For anyone wondering how to upload the Symbols file ... https://support.google.com/googleplay/android-developer/answer/9848633?hl=en#zippy=%2Cupload-files-using-play-console – markhops Nov 08 '21 at 02:58
  • 4
    Thanks so much for this! Silly me thought that the *.symbols files were what needed to be uploaded for the "Native debug symbols" and not a zip of folders containing *.so files. – user697576 Jan 31 '22 at 21:53
  • I'm using react native. I could not find merged_native_libs folder !! this is the path I tried : android/app/build/intermediates – Joseph Ali Jul 11 '22 at 11:51
  • nice, flutter should add compressed file with easy access jejej – GusZL Jan 27 '23 at 07:40
  • For me the folder is actually at: [YOUR_PROJECT]\build\app\intermediates\merged_native_libs\release\out\lib – Deepak Joshi May 15 '23 at 21:02
  • I did that but it told me it contains MACoS files and only Android is supported, any Idea what to do? I am using macos – Mark Nugromentry May 26 '23 at 19:12
  • To prevent macOS files in the zip, use terminal instead: 1. `cd you_project_path/build/app/intermediates/stripped_native_libs/productionRelease/out/lib` 2. `rm .DS_Store` 3. `zip -r symbols.zip .` And for anyone getting errors not accepting the .so files from this directory use build/app/intermediates/stripped_native_libs/productionRelease/out/lib instead. – giorgos.nl Jul 12 '23 at 08:53
73

If talking about Flutter, looks like the Flutter team needs to change some source files for the NDK, because it does not see where from to generate debug symbols.

Here is an issue thread: https://github.com/flutter/flutter/issues/60240

Setup steps are so:

  • Pre-condition: Intall Android studio 4.1+ and Gradle 4.1+
  1. Install NDK (Side by Side) in SDK manager enter image description here

  2. Write path to NDK in local.properties enter image description here

  3. Add in app/build.gradle (last line) android.buildTypes.release.ndk.debugSymbolLevel = 'FULL' enter image description here

Mahdieh Shavandi
  • 4,906
  • 32
  • 41
Shakle
  • 1,348
  • 13
  • 11
  • 3
    I followed the same I get this, * What went wrong: A problem occurred evaluating project ':app'. > Could not get unknown property 'ndk' for BuildType_Decorated{name=release, – MSaudi Jan 02 '21 at 10:45
  • @MSaudi See this link - I had the same problem. It was resolved after upgrading my gradle version. See https://stackoverflow.com/a/63436935/7015661 – TM00 Jan 31 '21 at 15:38
  • `ndk.dir` is [depreciated](https://developer.android.com/studio/releases?utm_source=android-studio#4-0-0-ndk-dir) – lasec0203 Jun 18 '21 at 05:06
  • 1
    Is this option for Flutter apps better than compressing the \build\app\intermediates\merged_native_libs\release\out\lib symbols? Using the NDK is automatic yeah, but the symbols produced by the NDK seems to be much much smaller than the symbols located in the mencioned folder. For my app, NDK size was 5kB and merged_native_libs was 12MB – Bugzilla Dec 19 '21 at 11:08
  • @Bugzilla, why is smaller not preferred? – MartianMartian Oct 21 '22 at 04:43
  • Why last line tho? – Litva Nick Nov 01 '22 at 09:30
47

Before you can upload debug symbols files, you must be using Android Gradle plugin version 4.1 or higher.

Looks like it will come only with Android Studio 4.1, because I can only get Gradle 4.0.0 automatically now.

So I suggest you to return classic Play console and it will let you through :)

UPDATE: So just use an updated Gradle and add NDK debug symbols to the build now

Shakle
  • 1,348
  • 13
  • 11
  • 2
    Dang, I think you're right. I can also go only up to 4.0 with Android Studio 4.0. – dasfima Jun 25 '20 at 13:04
  • 1
    Ok Thanks I will try it with the classic Play console – fleepp Jun 26 '20 at 10:29
  • 1
    YES! It worked (I used the classic Play Console). Thank you so much! – fleepp Jun 26 '20 at 11:39
  • 2
    I don't think so, there will be some changes that we need to do in the future. What if I want to the new Play Console? – Pratik Butani Sep 15 '20 at 09:57
  • @PratikButani then you need to get Gradle plugin 4.1 which is probably available with some Android Studio 4.1 beta program now. Later when it is released, it will be available as default – Shakle Sep 16 '20 at 10:04
  • 1
    Added a new description in the post below. The setup is right, but looks like Flutter team needs to update some building things – Shakle Nov 07 '20 at 15:31
  • 1
    Almost one year later, you must to use the new Play Console, so, turning back to the "classic console" isn't a option. – Néstor Aug 23 '21 at 16:49
  • It also needs to be the gradle plugin lower than 4.2.0 – Jaden Lorenc Feb 19 '22 at 21:42
27

The Answer was given by Shakle will be not useful as per the following message on Play Console.

The old version of Play Console will be discontinued from November 2, 2020 You’re already using the new Play Console, so you don’t need to do anything. A few features are going away if you want to check them one last time.

It's just a warning, nothing else. Just go ahead.

If you don't want any warning, Go to this link and follow the steps:

https://support.google.com/googleplay/android-developer/answer/9848633?hl=en

You can use the new version of the play store as it is.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
22

you can make these zip file by go to build\app\intermediates\merged_native_libs\release\out\lib inside your Flutter project

and compress the folders into symbols.zip, now upload it into the google play console

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
8

I had a similar problem. What really helped me:

  1. Make sure your Android Gradle plugin version is 4.1 or later.
  2. Install NDK (Side by Side) in SDK manager.
  3. Install CMake in SDK manager.
  4. Add
    ndkVersion <ndkVersion>
    ndk {
      debugSymbolLevel 'FULL'
    }

to app/build.gradle

My final build.gradle:

...
android {
  compileSdkVersion 30
  defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 28
    versionName "1.0.59"
    ndkVersion "23.1.7779620"
    ndk {
      debugSymbolLevel 'FULL'
    }
  }
  buildTypes {
    release {
      minifyEnabled true
      shrinkResources true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }

  configurations {
    compile.exclude group: 'com.google.zxing'
  }
}
...

I hope this will help you and save you time

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '21 at 17:34
  • To make this work in vsCode, I had to add the now deprecated option ndk.dir=/path/to/ndk in the local.properties file. – Bob Dec 14 '21 at 09:57
  • ndkVersion "23.1.7779620" this or it can be anything? – DragonFire Jan 14 '22 at 03:51
  • @DragonFire the number you add has to match the version you installed (via sdk manager) – joe Mar 22 '22 at 13:36
7

If you want to solve this warning error: 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. Make sure also to install CMake

This will happen if your gradle version is higher than 4.0 Place this code into your build.gradle file

android {
compileSdkVersion 28
defaultConfig {
    applicationId 'com.example.myproject'
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0.0"
    ndk {
        debugSymbolLevel 'FULL'
    }
}
Kneelon
  • 239
  • 3
  • 12
  • 1
    @Rishav did you manage to solve it in React Native? – Lawrence Macharia Apr 24 '21 at 00:36
  • 8
    @LawrenceMacharia No. I realized that I don't care and everything is meaningless. – Rishav Apr 28 '21 at 09:55
  • 2
    this solution worked for me with React-Native, but for my case, I had to install CMake and update my NDK to version 23.0.7599858, then I updated it on build.gradle(app) and finally followed this solution: https://stackoverflow.com/a/65367767/6674314 – a curious guy Sep 02 '21 at 20:10
  • 2
    @acuriousguy solution worked for me with React Native as well. Make sure to install CMake: https://developer.android.com/studio/projects/install-ndk#kts and set the debugSymbolLevel to `FULL` instead of `SYMBOL_TABLE` – Allen Sep 24 '21 at 18:46
  • 1
    @LawrenceMacharia In my case, for React Native, I had to manually zip up these files here: app/build/merged_native_libs/myAppRelease/out/lib and upload Native Debug Symbols - after moving back to the "Edit Release" step, and then tapping "Review Release" the error went away! – Seth May 11 '22 at 15:34
5

Instead of creating and uploading zip files, you can include the following to your app\build.gradle file:

buildTypes {
    debug { 
        // This is just here for local testing and is optional.
        firebaseCrashlytics { 
            nativeSymbolUploadEnabled true
            unstrippedNativeLibsDir file("build/app/intermediates/merged_native_libs/debug/out/lib")
        }
        ndk {
            debugSymbolLevel 'SYMBOL_TABLE'
        }
    }
    release {
        // ..
        firebaseCrashlytics { // Insert this
            nativeSymbolUploadEnabled true 
            unstrippedNativeLibsDir file("build/app/intermediates/merged_native_libs/release/out/lib")
        }
        ndk {
            // replace with 'FULL' if you need more info,
            // but note that it will increase the file size of your appbundle dramatically.
            debugSymbolLevel 'SYMBOL_TABLE'
        }
    }
}

Here is some documentation for reference: https://firebase.google.com/docs/crashlytics/ndk-reports#upload-symbols-external-dependencies

And if you're unclear about how to set up automatic uploading of native symbols, try adding this:

buildTypes { ... } // Your build types from the above snippet.

tasks.whenTaskAdded { task ->
    if (task.name.startsWith('assemble') && task.name != "assembleReleaseAndroidTest"
            && task.name != "assembleDebugAndroidTest") {
        String taskName = "uploadCrashlyticsSymbolFile" + task.name.substring('assemble'.length())
        task.finalizedBy taskName
        doFirst {
            println "Running Gradle task '$taskName'..."
        }
    }
}

More info for building gradle tasks here: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html

Also, ensure that you have NDK and CMAKE installed in your IDE's SDK Manager.

Hope that helps!

Adam Bridges
  • 306
  • 3
  • 7
4

Simple approach, go to \build\app\intermediates\merged_native_libs\release\out\lib , you will find 3/4 folders , zip those , upload this ZIP from release option ( upload Symbol File ). Warning will be gone after bundle review.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
Md omer arafat
  • 398
  • 7
  • 10
2

For fixing it in the Visual Studio Code: you should first download the NDK from the android's website.

  • Extract the zip file to a folder named ndk and place it under your - already installed - Android SDK folder. Like this: Android/sdk/ndk

  • Then open app/build.gradle.

  • Under the Android section. Add ndkPath property as follows: ndkPath = <ndk-dir>

app/build.gradle ndkPath property

  • At the end of app/build.gradle add android.buildTypes.release.ndk.debugSymbolLevel = 'full'

  • The next appbundle, built by flutter build appbundle command should not give any errors on the play store about native debug symbols.

a more thorough explanation is here

KHAN
  • 537
  • 5
  • 12
2

I just upgraded ndk from 21.4.7075529 to 22.1.7171670, and now I get the debug symbols.

I'm using com.android.tools.build:gradle:7.1.1 and React Natvive 0.69 BTW.

Oyvind Habberstad
  • 1,004
  • 11
  • 14
1

I have the exact same issue.

Possible solutions:

  1. Use the Google classic Play console
  2. Gradle 4.1 is now released with Android Studio 4.1
LiveRock
  • 1,419
  • 2
  • 17
  • 27
0

Could not get unknown property 'android' for project ':app' of type org.gradle.api.Project.

You have to add it in gradle.properties not build.gradle

majdi
  • 42
  • 2
  • 1
    This is inaccurate as per the documentation at https://developer.android.com/studio/build/shrink-code#native-crash-support – AlgoRyan Jan 18 '21 at 23:44
  • See https://stackoverflow.com/a/63436935/7015661 to upgrade gradle version – TM00 Jan 31 '21 at 15:38
0

I was able to get Flutter to build native debug symbols using Android Gradle Plugin (AGP) 4.1.0, installing corresponding NDK version and adding the appropriate config to android/app/build.gradle on macOS (but it should also work on Windows/Linux).

  1. Optional: Run flutter build appbundle and take note of the .aab file size
  2. Check what version of AGP you're using in android/build.gradle by looking in dependencies e.g. com.android.tools.build:gradle:4.1.0 is 4.1.0
  3. Check which version of NDK you need. Assuming your AGP is 4.1.0 the NDK version you want to install is 21.1.6352462 (for other AGP versions check mappings here)
  4. Install specific NDK version using Android Studio. Alternatively you can use sdkmanager and the CLI: $ANDROID_HOME/tools/bin/sdkmanager --install "ndk;21.1.6352462"
  5. In android/app/build.gradle, under android.defaultConfig add ndk { debugSymbolLevel 'FULL' } aka set android.defaultConfig.ndk.debugSymbolLevel = 'FULL' as per this
  6. Run flutter build appbundle. The .aab should now contain native debug symbols and be larger than the previous build in step 0

Troubleshooting: If you get any errors around CMake I didn't explicitly install it but you might need to, especially if you're using Windows, and you can do so using Android Studio.

connorads
  • 510
  • 1
  • 6
  • 12
0

screenshot

My issue was this:

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.

Fix successfully just upload native debug symbols from the image reference directory shown.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
  • 1
    Hi Jamshed, thanks for taking the time to post, however, your answer is exactly the same as the most upvoted answer. – Seoester Feb 09 '23 at 18:16