Playstore error: App Bundle contains native code, and you've not uploaded debug symbols

Android StudioFlutterGoogle Play

Android Studio Problem Overview


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

Android Studio Solutions


Solution 1 - Android Studio

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

Solution 2 - Android Studio

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

Solution 3 - Android Studio

Reproduce next steps and this warning will disapear

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

note that exist 3 folders inside

  • arm64-v8a
  • armeabi-v7a
  • x86_64
  1. Select this 3 folder and create a .ZIP file. Name doesnt matter.

[PLEASE NOTE THAT I HAVENT COMPRESSED THE ./lib FOLDER]

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

.

Solution 4 - Android Studio

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.

Solution 5 - Android Studio

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

Solution 6 - Android Studio

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'
    }
}

Solution 7 - Android Studio

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

Solution 8 - Android Studio

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

Solution 9 - Android Studio

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

Solution 10 - Android Studio

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.

Solution 11 - Android Studio

>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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionfleeppView Question on Stackoverflow
Solution 1 - Android StudioShakleView Answer on Stackoverflow
Solution 2 - Android StudioShakleView Answer on Stackoverflow
Solution 3 - Android StudioskylletView Answer on Stackoverflow
Solution 4 - Android StudioPratik ButaniView Answer on Stackoverflow
Solution 5 - Android Studioalmamon Rasool Abd AliView Answer on Stackoverflow
Solution 6 - Android StudioKneelonView Answer on Stackoverflow
Solution 7 - Android StudioKHANView Answer on Stackoverflow
Solution 8 - Android StudioTaras SvidnytskyyView Answer on Stackoverflow
Solution 9 - Android StudioLiveRockView Answer on Stackoverflow
Solution 10 - Android StudioconnoradsView Answer on Stackoverflow
Solution 11 - Android StudiomajdiView Answer on Stackoverflow