Android initialization requires manual configuration of the Android build template and Gradle files.
1. Gradle Dependencies
In res://android/build/build.gradle, add the following to the dependencies section:
// EOS SDK dependencies
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.security:security-crypto:1.0.0'
implementation 'androidx.browser:browser:1.4.0'
// Path to the .aar file in the plugin bin folder
implementation files('../../addons/epic-online-services-godot/bin/android/eossdk-StaticSTDC-release.aar')
2. Android Configuration
In res://android/build/build.gradle, add the following inside the android.defaultConfig section:
// This is needed by EOS Android SDK
String ClientId = "PUT YOUR EOS CLIENT_ID HERE"
resValue("string", "eos_login_protocol_scheme", "eos." + ClientId.toLowerCase())
3. Minimum SDK Version
In res://android/build/config.gradle, update minSdk to 23:
minSdk : 23
4. Java Initialization
In res://android/build/src/com/godot/game/GodotGame.java, load the library and initialize the SDK:
package com.godot.game;
import com.epicgames.mobile.eossdk.EOSSDK;
import org.godotengine.godot.GodotActivity;
import android.os.Bundle;
public class GodotApp extends GodotActivity {
static {
System.loadLibrary("EOSSDK");
}
@Override
public void onCreate(Bundle savedInstanceState) {
EOSSDK.init(getActivity());
setTheme(R.style.GodotAppMainTheme);
super.onCreate(savedInstanceState);
}
}
5. Export Settings
When creating the Android export profile in Godot:
- Enable Use Gradle Build.
- Enable arm64-v8a architecture.
- Enable permissions:
ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE, and INTERNET.