Openfl android extension

I tried to make an openfl extension for android and I didn’t succeed. So I have few questions:

-do I need to install Gradle?
-do I need to do lime rebuild . android inside my extension folder? (I tried but nothing happens, no change in my extension folder)
-how can I link an .aar library? (when I try to compile from a project that uses the extension, it says : “error: package com.google.ar.core does not exist”. I have also try with a .jar extracted from the .aar with same results.

Running openfl create extension NameOfYourExtension should help scaffold some of the basics for a native extension.

The extension has a code path for C++ code and one for Java code. If you doing a Java-only extension then you should be able to avoid the C++ code and will not need to run lime rebuild path/to/extension android since the Java code is not pre-compiled.

Perhaps these instructions would help for adding an AAR library to the build.gradle file for the native extension?

1 Like

Thanks for the clarification.

Thanks. I tried but it seems that the compiler doesn’t find the .aar file.

Could not find :arcore_client:.
        Searched in the following locations:
            http://jcenter.bintray.com//arcore_client//arcore_client-.pom
            http://jcenter.bintray.com//arcore_client//arcore_client-.aar
            https://maven.google.com//arcore_client//arcore_client-.pom
            https://maven.google.com//arcore_client//arcore_client-.aar
            file:/I:/WORK/Workspace/ar_openfl_test/bin/android/bin/deps/augmentedreality/libs/arcore_client-.aar
            file:/I:/WORK/Workspace/ar_openfl_test/bin/android/bin/deps/augmentedreality/libs/arcore_client.aar

I also tried to extract the .jar and the res folder from the .aar adding compile fileTree(dir: 'libs', include: '*.jar') to Gradle :

Execution failed for task ':deps:augmentedreality:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'F:\Development\Android SDK\build-tools\29.0.0\aapt.exe'' finished with non-zero exit value 1

And finally, I tried to use the google repository by adding this in gradle:

allprojects {
   repositories {
	  google()
   }
}
dependencies {
implementation 'com.google.ar:core:1.10.0'
}

And this is the error I get : Could not find method google() for arguments [] on repository container.

I hope I’ll find a solution.

Instead of google(), try

maven { url “http://maven.google.com” }

Thanks.

I got

Execution failed for task ':deps:augmentedreality:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'F:\Development\Android SDK\build-tools\29.0.0\aapt.exe'' finished with non-zero exit value 1

Could be a mismatch version problem according to internet. I’ll try with different version of the sdk.