How and where to edit Gradle for Android build


#1

I was previously using Flixel 4.2, lime 2.9.1 and openfl 3.6.1 to build on Android. I was overriding the default AndroidManifest.xml file using my own custom templates folder as described here: https://player03.com/2014/08/14/template-basics. Everything worked great, my AndroidManifest’s min sdk version was 9 and my target was 26.

But now after upgrading to Flixel 4.4, lime 6.3.1, and openfl 8.1.1 I’m having trouble building on Android. I got all my extensions to work but now for some reason my AndroidManifest.xml keeps getting replaced by an auto-generated one I believe gradle is making. This new AndroidManifest file causing conflicts is located in gradle’s app/src/main directory. My old version was using Ant so Gradle is completely new to me.

Does anyone know how and where to edit Gradle? Any help is appreciated, thank you!


#2

I don’t think Gradle would overwrite your file, but Lime might.

Are you sure you’re putting your manifest file in the correct spot? The new location is - as you’ve discovered - app/src/main/AndroidManifest.xml.


#3

I don’t think lime is the problem because I tried replacing lime’s template AndroidManifest.xml with a hardcoded version and I got the same error.

I also updated my project.xml with template path=“templates/AndroidManifest.xml” rename=“app/src/main/AndroidManifest.xml” if = “android”/

I think the problem is being caused by some kind of merging conflict with one of my extensions’ dependencies. The project I’m trying to build is kind of complicated so I’ll try to test a much simpler project and let you know how it goes.

This is the error I get:

Execution failed for task ‘:app:processDebugManifest’.

Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services-ads:11.0.4] C:\Users\Fatman\SUPERCEREAL\export\android\bin\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\11.0.4\AndroidManifest.xml
Suggestion: use tools:overrideLibrary=“com.google.android.gms.ads.impl” to force usage

BTW my old setup works fine so I’m in no rush to get this fixed. Thanks for the help!


#4

Hey I managed to fix the problem on my own!

Gradle automatically added each extensions dependencies from my Android/SDK extras folder (with Ant I was manually adding in jars before).

So I just upgraded my AndroidManifest.xml min sdk to 14 and added this line in the project.xml:
<config:android gradle-build-directory=“C:/Haxe/GradleBuilds” /> because the default path name was too long.

Now the project works and I can even see mobile debug code on HaxeDevelop’s console! Thanks!