I googled this quite a bit, but came out empty handed. There were some links but those related to source code version of UE. Before going down that path I decided to asks here whether there is some simple way to add and access an .aar library in my UE 4.20 Android project?
I found this announcement telling that aar files can be registered e.g. in aar-imports.txt. It continues about gradle files, but it remains a bit unclear whether something more needs to be added there or not. I really wish there were a solid document about using .aar files!
Based on some forum advice, I inserted my lib into aar-imports.txt file, like this
repositories $(ANDROID_HOME)/extras
repositories $(ENGINEDIR)/Source/ThirdParty/Android/extras
com.google.android.gms,play-services-auth,11.8.0
com.google.android.gms,play-services-games,11.8.0
com.google.android.gms,play-services-nearby,11.8.0
com.google.android.gms,play-services-plus,11.8.0
com.mycompany.myproduct.mylib,mylib-release,1.0
and inserted the lib under C:\NVPACK\android-sdk-windows\extras\m2repository\com\mycompany\myproduct\mylib\mylib-release\1.0\mylib-release-1.0.aar, together with a handmade POM file.
POM file:
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>1.0</modelVersion>
<groupId>com.mycompany.myproduct.mylib</groupId>
<artifactId>mylib-release</artifactId>
<version>1.0</version>
<packaging>aar</packaging>
</project>
I also added the following lines into gradle.properties file in the Android Studio:
POM_NAME=mylib-release
POM_ARTIFACT_ID=mylib-release
POM_PACKAGING=aar
Although I am not sure are these necessary or not.
It seems that this way the file is included into the build. At least the Unreal launch complained over wrong paths until I got them right.
To get forward I should now make AndroidThunkJava_* methods for all my library public static methods, I think.
Should I make a class similar to AndroidJNI.*, except for my own library only? Or should I add my own library methods into AndroidJNI class? And where to put these files (in same place as AndroidJNI or somewhere in my own project structure)?