Issues building with Native text on Android

Currently on the latest versions of lime and openfl and using Native text library which has been working fine for version 3.6.1 but moving to the latest release has given me this error which is quite odd to me, especially since it says gradle which I thought openfl uses ANT. Native Text Github Link

D:\gameDesign\thinQbator\export\android\bin\deps\nativetext\res\drawable-ldpi\android_library_force_resource_generation.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Development\Android SDK\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 42
:deps:nativetext:mergeReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':deps:nativetext:mergeReleaseResources'.
> D:\gameDesign\thinQbator\export\android\bin\deps\nativetext\res\drawable-ldpi\android_library_force_resource_generation.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Development\Android SDK\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 42

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.352 secs
``

Lime uses Gradle now, not ANT.

To enable the --info flag, try <setenv name="ANDROID_GRADLE_TASK" value="assembleDebug --info" />. If that doesn’t work, let me know so I can submit this as a pull request.

1 Like

I got this when I ran the build with that xml flag in my project.xml.
FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘assembleDebug --info’ not found in root project ‘bin’.

  • Try:
    Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I might be mistaken on the location to put the flag.And if you have any info on how to convert a native extension to work with gradle that’d by extremely appreciated. Since running a blank project without native text runs no issues.

Ok, that’s what I thought might happen. I’ll submit the pull request.

Edit: submitted!

Edit 2: it’s accepted. You can either wait for the update, pull the latest Git version, or manually edit the version you’re already using.

1 Like

Actually, you’re probably right. Regardless of the error details, it can probably be solved by updating the extension for Gradle.

Basically, you want to rearrange the dependencies/android/ directory to look like this.

  1. Delete build.xml and project.properties.
  2. Create a src/ folder. Inside, create a main/ folder. Inside, create a java/ folder.
  3. Move libs/ into src/.
  4. Move the code files into src/main/java/. This is the root folder for Java code, so it should contain folders like com/ and org/.
  5. Move everything else into src/main/.
  6. Add build.gradle at the top level (meaning inside dependencies/android/).
  7. In build.gradle, get rid of “if (1 == 1)” and the eight extra colons. (There should be only three colons before ANDROID_GRADLE_PLUGIN and only two after.)

It’s been a while since I’ve done this, but I think that covers everything.

1 Like