Open fleepp opened 4 years ago
Hey @fleepp,
Have you tried looking into this? https://developer.android.com/studio/preview/features#native-crash-symbolization
Can you also share a replicable project with regards to this error? Otherwise, I suggest that this question is best addressed in StackOverflow, @fleepp. A lot of folks are happy to help there as well.
Let me know if this helps.
when I add this to my app/build.gradle, I get this error.
`android.defaultConfig.ndk.debugSymbolLevel = 'FULL'
def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }
def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }
def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "be.ambaamba.ehbo"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
}`
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
C:\Users\filip\AndroidStudioProjects\ehbo>
And THX I wil ask it in StackOverflow!
@fleepp Seems like we need Android Studio 4.1 (which isn't stable yet) for that.
Hi @fleepp
Can you please provide your flutter doctor -v
, pubspec.yaml
your flutter build bundle --verbose
and a complete reproducible minimal code sample
Thank you
flutter doctor -v
[√] Flutter (Channel master, 1.20.0-1.0.pre.91, on Microsoft Windows [Version 10.0.18362.900], locale nl-BE)
• Flutter version 1.20.0-1.0.pre.91 at C:\src\flutter
• Framework revision 9c3f0faa6d (8 days ago), 2020-06-17 18:47:54 -0400
• Engine revision 965fbbed17
• Dart version 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\filip\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code (version 1.46.0)
• VS Code at C:\Users\filip\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category.
pubspec.yaml
name: ehbo
description: A new Flutter application.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.1+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
http: ^0.12.1
url_launcher: ^5.4.10
overlay_support: ^1.0.0
flutter_spinkit: ^4.1.2+1
flutter_launcher_icons: ^0.7.5
flutter_icons:
image_path: "images/icon.png"
android: true
ios: true
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Baloo
fonts:
- asset: fonts/BalooBhaina2-Regular.ttf
- asset: fonts/BalooBhaina2-Medium.ttf
weight: 500
- asset: fonts/BalooBhaina2-SemiBold.ttf
weight: 600
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
@TahaTesser thanks for your time! It means a lot. I tried to share as much as I could (I hope not to much ;) ). I've saw an update so i'll wil do that as soon as i can.
"A new version of Flutter is available! To update to the latest version, run "flutter upgrade" "
I want to try to provide a 'reproducible minimal code sample' but honestly I don't know what you need. I am not so familiar with those technical terms. Do you mean a simple app and try to publish on the Playstore?
flutter doctor -v after upgrade:
[√] Flutter (Channel master, 1.20.0-1.0.pre.220, on Microsoft Windows [Version 10.0.18362.900], locale nl-BE)
• Flutter version 1.20.0-1.0.pre.220 at C:\src\flutter
• Framework revision 1e6e7150f3 (3 hours ago), 2020-06-26 12:01:59 +0800
• Engine revision 22b099bc63
• Dart version 2.9.0 (build 2.9.0-19.0.dev ea87c9b01a)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\filip\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code (version 1.46.0)
• VS Code at C:\Users\filip\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category.
Hi @fleepp This doesn't seem to be related to Flutter itself since app bundle builds successfully and looks more related to Android Studio itself
Closing, as this isn't an issue with Flutter itself. If you disagree, please write in the comments and I will reopen it. Thank you
Did you get any answer for this? I've seen this question in Stack Overflow, it says 'return Classic Play Console' and i don't know what does it mean. Can you help me out?
Use https://play.google.com/apps/publish/ and not the beta version of the Google Play Console on https://play.google.com/console/developers/
@TahaTesser This may be well related to Flutter, actually. Flutter creates native libraries (.so) to handle the rendering - and currently, the debug symbols are not included in the bundle/APK that the flutter build system generates.
I am just now trying to debug a native crash report for a Android app but am unable as the symbols are missing.
Android/Gradle can't include something they can not find and it should be the Flutter build system to make these files available.
@ened Thank you for explaining
In the interim, I will check if https://github.com/flutter/flutter/wiki/Crashes helps here - and download the appropriate symbols for the engine, then upload it to play store and hope it is picked up correctly.
This is still not ideal if an App has multiple native components in addition to Flutter.
@blasten adding you as the Gradle expert: There is now a way to automatically upload debug symbols to the play store like described here: https://support.google.com/googleplay/android-developer/answer/9848633#upload_file
This would be a immense time saver to have the stack traces ready immediately.
\cc @xster
where to add the below line in build.gradle?
android.defaultConfig.ndk.debugSymbolLevel = 'FULL'
Reasonable request. I'm surprised there aren't more dupes for this bug.
To be clear, there are 2 separate components to this:
1- It's possible for the Flutter engine to crash. This shouldn't happen when there are bugs in your Dart application code and should ideally never happen. All engine crashes are bugs on the Flutter SDK and we should fix them. Having debug symbols can help you file more actionable bugs for us. https://github.com/flutter/flutter/wiki/Crashes is relevant here and we can help make it easier.
This doesn't include the Java part of the Flutter engine which should produce normal crash logs. This also doesn't include the plugins which are normally written in Java. 2- It's possible for the Flutter application to crash as well. This includes code in the Flutter Dart Framework and in your own application code. This also shouldn't when there are bugs in your Dart application code and should ideally never happen. All Dart code bugs that leads to fatal native crashes are bugs on the Dart SDK and we should fix them. Having debug symbols can help you file more actionable bugs in the Dart SDK repository for us.
To help us prioritize, can you describe more what the specific problem you're trying to solve? Do you have an example crash case that happened in the past that you're looking for a better workflow to debug in the future? It could also be that you're just trying to make that Play Store warning go away.
@xster I'm running into this in the Play Store and would like the warning to go away :)
But I think it's also the case that in the event that native code does have a bug, and does crash, it seems highly unlikely that a busy dev shop is going to have the bandwidth to effectively understand and communicate those details to the Flutter team to get it resolved. To me, debug symbols seem like a fundamental necessity for reporting native code bugs that are only visible through the Play Store crash logs.
For what is worth, I followed the steps in https://stackoverflow.com/questions/63373245/how-to-add-debug-symbols-to-build-gradle (including the upgrade to gradle-6.5-all.zip
in android/gradle/wrapper/gradle-wrapper.properties
) and it worked for me. Of course this is not ideal as I had to use Android Studio to install NDK and CMake tools manually (which I guess it will be a problem when I want to automatize the deployment of new version), but it might be useful to someone having crashes and really needing to get the debug info up and running.
(disclaimer: I'm completely alien to Android development, all I know is through Flutter which I started using just a few months ago)
android.defaultConfig.ndk.debugSymbolLevel = 'FULL'
Does that work though? From what I played with, it looks like it adds debug information in the app bundle, but just the stripped binaries. So basically a duplicate of the libraries in the lib arquitectures folder.
I agree with @matthew-carroll . Currently symbolicating symbols from the Play Store is a bit tedious. Delegating this job to the new Play Store feature would be a helpful addition.
I can confirm that. :disappointed:
$ unzip app-release.aab
...
$ nm base/lib/x86_64/libapp.so
nm: base/lib/x86_64/libapp.so: no symbols
$ nm BUNDLE-METADATA/com.android.tools.build.debugsymbols/x86_64/libapp.so.dbg
nm: BUNDLE-METADATA/com.android.tools.build.debugsymbols/x86_64/libapp.so.dbg: no symbols
$ md5sum base/lib/x86_64/libapp.so
b9b5ea54e4ed5f78439e3f308fd79f74 base/lib/x86_64/libapp.so
$ md5sum BUNDLE-METADATA/com.android.tools.build.debugsymbols/x86_64/libapp.so.dbg
b9b5ea54e4ed5f78439e3f308fd79f74 BUNDLE-METADATA/com.android.tools.build.debugsymbols/x86_64/libapp.so.dbg
Same with libflutter.so
. Google Play didn't complain about missing debug symbols though :man_facepalming:
So what's the status of this? Looks like this SO answer explains the process quite well, but is it the recommended way?
How to solve this? Any progress?
Any progress?It's doesn't work even if I added debugSymbolLevel 'FULL'
in my Android build.gradle.
Any update on this?
Hello guys i was experiencing the same issue.... all i did is install NDK on android Studio and then changed my build tools From classpath 'com.android.tools.build:gradle:4.0.0'
TO : classpath 'com.android.tools.build:gradle:4.1.0'
added android.buildTypes.release.ndk.debugSymbolLevel = 'SYMBOL_TABLE' to the bottom of Android/app/ build.gradle file
hope this helps someone
If you wish to fix that on Visual Studio Code:
<android-sdk-dir>Android/sdk/ndk
Back to VSCode. Open your app
<project-dir>/android/app/build.gradle
android {
compileSdkVersion 30
ndkPath = "<android-sdk-dir>/Android/sdk/ndk"
...
At the end of app/build.gradle (the same file that you've added your ndkPath), add one of the following:
android.buildTypes.release.ndk.debugSymbolLevel = 'full'
orandroid.buildTypes.release.ndk.debugSymbolLevel = 'symbol_table'
Save file and run flutter build appbundle -v
from terminal. (v to check if there are other errors)
If it still doesn't worked out for you. Go to <project-dir>/android/local.properties
and set ndk.dir as follows:
ndk.dir = <android-sdk-dir>Android/sdk/ndk
The last option is deprecated but still works for now (Sep 21)
I'm asking due ignorance from my part.
Why do these debug symbol files are not included into the bundle APK when it is created? Why this step isn't automated by default?
Or, why the NDK and the configuration isn't available by default when creating an android project if is a requirement?
Some FYIs:
For anyone who is wondering, the android-sdk-dir
seems to be C:\Users\%USERNAME%\AppData\Local\Android\sdk\<release-foler>\out\lib
. Don't ask me why they are there.
I added ndkPath="C:\\Users\\<your-user>\\AppData\\Local\\Android\\Sdk\\ndk\\23.0.7599858"
inside the defaultConfig
under the gradle.build
app
I added ndk { moduleName="nowfollowme-jni" }
inside the defaultConfig
Under C:\<your-project>\app\src\main\
created the folders jni
and jniLibs
. Inside the jni
folder, I created a file Android.mk
with the following content:
LOCAL_PATH := $(call my-dir)
# Builds a dylib out of test.cpp
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.cpp
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
Added the following inside the productFlavors
section under android
in the gradle.build
app:
create("arm") {
ndk.abiFilters += "armeabi"
}
create("arm7") {
ndk.abiFilters += "armeabi-v7a"
}
create("arm8") {
ndk.abiFilters += "arm64-v8a"
}
create("x86") {
ndk.abiFilters += "x86"
}
create("x86-64") {
ndk.abiFilters += "x86_64"
}
create("mips") {
ndk.abiFilters += "mips"
}
create("mips-64") {
ndk.abiFilters += "mips64"
}
// To include all cpu architectures, leaves abiFilters empty
create("all")
You will find the *.s0
files, in separate folders, in here C:\<your-project>\app\build\intermediates\merged_native_libs
. Create the zip files with those folders
In the Google Play Console, go to the App bundle explorer section.
Native debug symbols
. There is an upload icon to the right most part. Click on it and upload the zip file you created wit those folders.P/D:
@CengizhanParlak your workaround only works to generate native-debug-symbols.zip file when I run flutter build apk
but there is no native-debug-symbols.zip file when I run flutter build appbundle
. Do I need to use specific version of ndk? I'm using the latest version now
... but there is no native-debug-symbols.zip file when I run
flutter build appbundle
.
@RakaAlrian Well, there shouldn't be.. If you run the flutter build appbundle
command to build your project then native debug symbols are bundled with the resulting app. You don't have to do anything, native debug symbols are in this bundle. Just simply upload your resulting aab to google developer console.
It shouldn't give any errors.
Does anyone know how the solution proposed by many -- to setup the NDK and add android.buildTypes.release.ndk.debugSymbolLevel = 'full'
to app/build.gradle -- meshes with building an appbundle with obfuscation enabled? That is, with
flutter build appbundle --obfuscate --split-debug-info
Will the obfuscation still be effective, or does including the debug symbols counteract that?
I am not sure what the accepted wisdom is here. I thought that simply upgrading to flutter 2.5.3 might do the trick, but that didn't work. What should I do? I'm tempted to just ignore the message, and move on with my life. My developer-senses tell me that's a bad idea, though.
I am not sure what the accepted wisdom is here. I thought that simply upgrading to flutter 2.5.3 might do the trick, but that didn't work. What should I do? I'm tempted to just ignore the message and move on with my life. My developer-senses tell me that's a bad idea, though.
Have you tried the proposed solutions for Android Studio and/or VSCode? Don't rely on Flutter version update since it doesn't give you the NDK tools that you -basically- need to overcome this problem.
Have you tried the proposed solutions for Android Studio and/or VSCode? Don't rely on Flutter version update since it doesn't give you the NDK tools that you -basically- need to overcome this problem.
Don't work for flutter build appbunle
. Don't know why
I followed this answer (this seems a very careful answer):
https://stackoverflow.com/a/63436935/566360
But it still does not work .
The size of app-release.aab
remains the same. And in the output of flutter build appbundle -v
, I see this line existing
Task :app:stripReleaseDebugSymbols
These steps helped me: https://stackoverflow.com/a/70337587/11647050
@vietstone-ng I had to install the ndk manually via android studio.
To make it work in vscode I had to set in the local.properties
file the deprecated
ndk.dir=/path/to/ndk
as described here.
I am running into this problem. Newest version of Android Studio bumblebee, newest version of flutter, newest version of gradle, and every combination of the solutions on this thread and linked, and flutter still doesn't bundle in the native debug symbols. Full description of the issue here:
https://stackoverflow.com/q/71179303/5229301
Sadly the only way to solve this issue is this: https://stackoverflow.com/a/68778908/5894824 Why does Flutter still not support this?
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. I hope this might work for a Flutter project too, since this is more regarding Android build, than specific to Flutter/React Native I suspect.
Face this issue as well, spent a lot of time solving but to no avail. It's not affecting the app feature, but quite annoying to see the warning at Play Console. Hope Flutter able to solve this soon.
I'm facing the issue as well. I only managed to get debug symbols by using Gradle Plugin 4.3.1 (as suggested here https://www.androidbugfix.com/2022/03/flutter-does-not-include-native-debug.html).
Android Studio Dolphin 2021.3.1 (Build #AI-213.7172.25.2113.9123335)and Flutter 3.3.7 I tried using NDK 25.1.8937393, with Gradle Wrapper gradle-7.5.1-all.zip and Gradle Plugin 7.3.1, and didn't worked for me.
This is how I solved: I'm using gradle 7.5 and flutter 3.10.5 and what I have been doing for the past 2 years is this
get the contents of this folder(./build/app/intermediates/merged_native_libs/release/out/lib
), zip it and upload to Google Play at that three dots option on the bundle where there's an option "upload debug symbols" or something like that.
these are the contents zipped:
this is my ./android/app/build.gradle
release code:
release {
signingConfig signingConfigs.release
ndk {
debugSymbolLevel 'SYMBOL_TABLE' //<--- this defines what goes to those symbols
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir file("build/app/intermediates/merged_native_libs/release/out/lib")
}
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
hope that helps
@Fernandomr88 It seems like you are doing the same as the guy that I linked here: https://stackoverflow.com/a/68778908/5894824
@Fernandomr88 It seems like you are doing the same as the guy that I linked here: https://stackoverflow.com/a/68778908/5894824
yup, seems like it.
looks like Flutter has some incompatibilities with gradle versions as per https://github.com/flutter/flutter/issues/98773
When i want to release a new flutter app bundle to the play store. 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.