android-native: SDL3 APK build for the native client
build-android-native.sh downloads SDL 3.4.16 (sha256-checked), builds libSDL3.so and libmain.so (native_render + port_platform + embedded Python) at API 24, and wraps them in the SDLActivity shell under android-native/ (package org.metin2port.client). push-android-client.sh copies the 40250 Client directory into the app's files/ with run-as (--locale XX selects locale_XX.cfg). port_logic links with --no-dependent-libraries on ELF targets so the verbatim `#pragma comment(lib, ...)` lines do not break lld. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0b701d88c3
commit
fd051cc3ed
@@ -0,0 +1,39 @@
|
||||
// SDLActivity shell around native_render (libmain.so). The native libraries, the SDL Java sources
|
||||
// and the assets come from ../build-android-native, produced by ../build-android-native.sh.
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
def nativeBuild = file("${rootDir}/../build-android-native")
|
||||
|
||||
android {
|
||||
namespace = 'org.metin2port.client'
|
||||
compileSdk 35
|
||||
defaultConfig {
|
||||
applicationId 'org.metin2port.client'
|
||||
minSdk 24
|
||||
targetSdk 35
|
||||
versionCode 1
|
||||
versionName '0.1'
|
||||
ndk { abiFilters 'arm64-v8a' }
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
sourceSets.main {
|
||||
java.srcDirs += "${nativeBuild}/_deps/SDL3-3.4.16/android-project/app/src/main/java"
|
||||
jniLibs.srcDirs = ["${nativeBuild}/jniLibs"]
|
||||
assets.srcDirs = ["${nativeBuild}/app-build/native_render/android-assets"]
|
||||
}
|
||||
packagingOptions {
|
||||
jniLibs { useLegacyPackaging = true }
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
lint { abortOnError = false }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x400003" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:allowBackup="false"
|
||||
android:extractNativeLibs="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:hardwareAccelerated="true"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.metin2port.client;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
/**
|
||||
* Runs native_render's main() (libmain.so). Command-line arguments come from the launch intent,
|
||||
* e.g. adb shell am start -n org.metin2port.client/.MainActivity \
|
||||
* --es args "--live-server 192.168.21.203:11000:13000 --login-screen"
|
||||
* Without arguments the client runs against the in-process fake server once Client/ is in files/.
|
||||
*/
|
||||
public class MainActivity extends SDLActivity {
|
||||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[] { "SDL3", "main" };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
Intent intent = getIntent();
|
||||
String args = intent != null ? intent.getStringExtra("args") : null;
|
||||
if (args == null || args.trim().isEmpty())
|
||||
return new String[0];
|
||||
return args.trim().split("\\s+");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Metin2</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user