AndroidX support


I’m currently working on an android/ios plugin which relies on androidX, so I activated it using UPL, but since UnrealEngine version 4.25 there are 2 new imports in the GameActivity from support libraries v4 and gradle gives me an error, that those two imports couldn’t be found. Does anyone have an idea on how to replace those two imports with the androidX pendants? I don’t want to manually change the imports after packaging in UnrealEngine because this is for a plugin… :confused: I already tried the command in UPL but it seems, that it can only be used for the current context and not the whole file…

I hope you can help me to achieve androidX support for UnrealEngine! :slight_smile:

Thanks already:)

For those who are struggling too:
I fixed the issue by using replace string in gradle like this:

task replaceImport {
    	ant.replace(token:'import;', value:'import;') {
    		fileset(dir: 'src/main/java/com/epicgames/ue4', includes: '')
    	ant.replace(token:'import;', value:'import androidx.core.content.FileProvider;') {
    		fileset(dir: 'src/main/java/com/epicgames/ue4', includes: '')
build.dependsOn replaceImport

How did you manage to resolve other dependencies in Like android permissions plugin or obb-downloader activity? It’s not just imports. I don’t want to make changes in engine as well.

I fixed them by adding a Plugin-Level “ThirdParty”-folder, which contains all files, who are causing issues, with androidX libraries. They can simply replaced in the build process like this:

<copyDir src="$S(PluginDir)/../ThirdParty/Android/permission_library" dst="$S(BuildDir)/JavaLibs/permission_library" />

<copyDir src="$S(PluginDir)/../ThirdParty/Android/permission_library" dst="$S(BuildDir)/gradle/permission_library" />

Hope that helps!

1 Like

Thanks! That really helped

1 Like

I wrote on article how we are migrating the project to Android X in for our plugins How to force the Unreal Engine Android project to use AndroidX? | by Taras Leskiv | nineva | Medium - it’s described there in detail.

GitHub - ufna/AndroidX-UE4: AndroidX support for Unreal Engine 4 look at this