10

This Is Regarding PlayStore Warning debug symbols

I Have Successfully Build Gradle After Adding Line To build.gradle(app)

     android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'

but Following The Instruction https://developer.android.com/studio/build/shrink-code When I Build An Apk, I Can't Find native-debug-symbols.zip File , So My Question Is How To Get The File native-debug-symbols.zip File

Rituparno
  • 101
  • 1
  • 8

4 Answers4

6

The file is automatically included in your signed bundle (the .aab file) if you have managed to have the new Gradle, NDK Settings, and CMAKE installed and properly configured in your project. As well as the Gradle settings as discussed in many other comments. So you don't need to upload it manually.

To check if the obfuscation file was added prior to launching it on Google Play Store, create a new signed bundle .aab file. In Android Studio, when the file is created there will be a small pop-up that looks like this. Click the analyze the app button.

analyze the app button

Then you will see it here: debug symbols file

If you see it there, you can upload it to PlayStore and you're good to go.

The Fluffy T Rex
  • 430
  • 7
  • 22
  • I use circleci to release aab file and upload to the console, then I download and analyzed aab, saw the .debugsymbols inside BUNDLE-METADATA folder, but google console said it not there, need me to upload it manually. But when I generate aab using my macbook is fine. Idk why – Tuan Dat Tran Sep 17 '22 at 09:52
4

Found the native-debug-symbols.zip, it generated after I use this step : Build -> Generate Signed Bundle / APK -> APK.

Then it created on folder build->outputs->native-debug-symbols

I don't know to be sure what cause that, but what I tried is change the code

from android.defaultConfig.ndk.debugSymbolLevel = 'FULL'

to android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'

Also I double check wether NDK is downloaded into my SDK.

And also there is android.ndkVersion '22.1.7171670' generated inside my build.gradle

And File -> Project Structure -> Download Android NDK if not downloaded.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Muhammad Kamal
  • 324
  • 3
  • 12
4

I am not sure if the answer by @MuhammadKamal worked for me but it may have put me on the right track. I think more than just the latest NDK are needed for this to work properly. I was previously using Android Studio 4.2.1 but was sticking to older versions of CMake and NDK and used Gradle Plugin 4.2.1.

To make the debug symbols to be generated I updated all my build.gradle files and now the android application bundle (AAB) looks different as it did before and the native-debug-symbols.zip was also not generated on my system.

I believe that NDK version 22.1.7171670 is required for debug symbols to be added to the AAB automatically. android.ndkVersion '22.1.7171670'

And I also switched to a newer version of CMake: externalNativeBuild.cmake.version "3.18.1".

And I am now using Gradle Plugin 4.2.2 in Android Studio 4.2.2.

On my system Gradle was complaining about the debug symbol level setting when it was set to 'FULL'. It seems the value has to be in lower case. This could have been a change introduced in the newer gradle plugin version: android.buildTypes.release.ndk.debugSymbolLevel = 'full'.

I am not entirely sure which of these changes if not all made the debug symbols get embedded into the AAB automatically and the zip file generated. If just the newer NDK is needed please feel free to accept the answer by @MuhammadKamal. I wanted to document for others what worked in my build to fill in any blanks and potentially help resolve the issue.

The debug symbols will be stored inside the AAB in this location: BUNDLE-METADATA\com.android.tools.build.debugsymbols\<ABI>\libX.dbg

Strictly speaking @DevDasTour was asking about the APK and the native-debug-symbols.zip only. From my testing the APK cannot contain the debug symbols while the ABB can.

If you still wish to upload the APK and the debug symbols separately to Google Play the native-debug-symbols.zip are generated here: <project_name>\build\outputs\native-debug-symbols\release\native-debug-symbols.zip

BTW the AAB will also contain the Java de-obfuscation mapping so that makes it just one file to uploaded to Google Play.

omahena
  • 768
  • 6
  • 15
  • It only worked once I added the `android.ndkVersion` field, but I don't get why is it needed... Android docs say you only have to add it if you want to test a specific version of ndk or if you have multiple ndk versions installed: https://developer.android.com/studio/projects/install-ndk#apply-specific-version – Rondev Feb 11 '22 at 00:37
  • @Rondev same with you...I have to add ndkVersion to android block to make it works. But based on the docs says the default NDK version for Android Studio/Gradle Plugin 7.0 is 21.4.7075529, and my installed ndk version is 24.0.8215888, so I suspicios this could be the reason you need to specify the version otherwise it just tries to find if 21.4.7075529 is installed? – Arst Mar 19 '22 at 11:05
  • I just upgraded from 21.4.7075529 to 22.1.7171670, and now I get the debug symbols. Thanks for pointing this out. I'm using com.android.tools.build:gradle:7.1.1 BTW. – Oyvind Habberstad Aug 31 '22 at 21:13
0

For me, I have done following to make it works.

  1. Install CMake and NDK (Side by Side) enter image description here As of writing this post the version is 24.0.8215888.

  2. Specify ndk version inside android block. Adding ndk.dir to local.properties is drepcated. Instead, we add ndk version inside android block in app's build.gradle. enter image description here

In Android docs here

Default NDK version per AGP version
Before release, each AGP version is thoroughly tested with the latest stable NDK release at that time. For AGP version 3.6 and above, that NDK version will be used to build your projects if you do NOT specify an NDK version in the build.gradle file. The default NDK version is documented inside the AGP release notes. The current default NDK versions are listed in the following table: enter image description here

and here

Default NDK version
If you download multiple versions of the NDK, the Android Gradle plugin now selects a default version to use in compiling your source code files. Previously, the plugin selected the latest downloaded version of the NDK. Use the android.ndkVersion property in the module's build.gradle file to override the plugin-selected default.

are not clear about what if there is only one ndk version installed, will it automatically pick up? For me I have to do this step.

Arst
  • 3,098
  • 1
  • 35
  • 42