Android Gradle symbols directive?

I’d like Gradle to include a symbol file to my app bundle, so crash reports from GooglePlay are detailed. They indicate that

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

must be included in the build.gradle file. This generates:

app/build/outputs/native-debug-symbols/variant-name/native-debug-symbols.zip

…which gets included into the app bundle, I’m guessing?

Now, I can’t find details on how to request this from the project.xml file. The only Gradle directive I have there is

<setenv name=“ANDROID_GRADLE_TASK” value=":app:bundleRelease" />

How can I accomplish this? Is there some secret sauce for the project.xml file, or am I supposed to hack one of the build.gradle files in the ./export directory tree?

It’s possible to customize the template that Lime/OpenFL uses for a particular target.

You can use the <template/> tag in your project.xml file to specify a directory with files to use instead of the ones in lime.

Your custom template directory should follow the same directory structure as Lime’s template directory here. So, if you want to customize one or more files in the Android template, you’d create an android subdirectory and make sure that the files have the same name inside there to override the ones that Lime provides by default.

In Lime, it looks like there are multiple _build.gradle_files. I’m not sure which one you want to customize. One is located at templates/android/template/build.gradle and another is at templates/android/template/app/build.gradle.

So, if you added <template path="mytemplates"/> in your project.xml file, you could create a file in your project named mytemplates/android/template/build.gradle or mytemplates/android/template/app/build.gradle. Just copy the one from Lime, and then tweak what you need to be different.

I should make myself clear that you don’t need to copy every file from Lime’s templates directory. Copy only the files you need to modify, and Lime will know to grab the rest of the defaults that are missing.

I hope this helps!

I added the directive in app/build.gradle, but

Could not find method debugSymbolLevel() for arguments [SYMBOL_TABLE | FULL] on object of type com.android.build.gradle.internal.dsl.NdkOptions.

There could be two problems, as I understand it. One, since OpenFL uses the older android_ndk_r15c, this feature may not even be available. It seems odd, since symbol tables are ubiquitous, but r15c is from long before app bundles.

The other potential issue is that the android gradle plugin requires this version

classpath ‘com.android.tools.build:gradle:4.1.2’

but in the template files, it’s referred to as

classpath ‘com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::’

Which is also how it’s listed in gradle.properties. I can’t find where substitution takes place. I set it as

<setenv name=“ANDROID_GRADLE_PLUGIN” value=“4.1.2” />

in my project.xml, but I get the same error. So, where is that version set? What is the default used by OpenFL?

What I have in my project.xml:

<config:android gradle-version=“6.7.1” />
<config:android gradle-plugin=“4.2.0” />

You can find more details here: https://github.com/haxelime/lime/issues/1476

It might be worth giving r21e a try. Not too long ago, I discovered that this NDK version works too, but not any newer ones yet.

Yep, I’m using android-ndk-r21e.

That’s closer still. I aimed lime at n21e and set the gradle versions. Gradle does recognize debugSymbolLevel now. But I’m getting an error:

Build-tool 31.0.0 is missing DX at /home/user/Android/Sdk/build-tools/31.0.0/dx

Which indeed is missing from my Sdk. I’ve reinstalled the build-tools (from Android Studio), but it’s still not showing up. What package does this (Dalvik compiler?) get installed from?

Thank you, I was able to build by soft linking d8 and d8.jar to dx and dx.jar. I’m not sure symbol info was included in the .aab, but when I went verify, GooglePlay rejected the build because the app is now requesting

android.permission.READ_PHONE_STATE

and requires a “privacy policy” but doesn’t specify how to satisfy this requirement. How did you get around this? Is it possible to simply not ask for this new permission? Can it be done from project.xml or must I include a custom android.manifest now? Or did you provide this policy through the Play Console, somehow?

The permission is coming from

uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from ./export/android/bin/app/src/main/AndroidManifest.xml:2:1-37:12 reason: org.haxe.extension has a targetSdkVersion < 4

But I am specifying in project.xml:

<config:android minimum-sdk-version=“19” target-sdk-version=“30” />

Is there a common method to dealing with this?

You should use search, most of your questions were already answered:

I had already read that thread. The READ_PHONE_STATE one gets added as a blanket default when a sdk version isn’t specified in a manifest. That’s why I tried adding versions to the extension-api manifest. But that didn’t work. What I’d like to do is remove the request for that permission. I don’t want it at all, as it makes GooglePlay need a privacy policy. I was hoping you might have some insight, but since you’re using admob, I think you actually want that permission.

Update: there’s a bug in Lime that doesn’t read the sdk versions in extention-api’s mainfest correctly. There’s also a commit which simply uses project.xml’s versions instead. Details:

I need to follow up to verify if debug symbols were actually included. But they weren’t at first glance, so that issue remains in progress. :-/