TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
韩天峰 f7f7547ffa feat(nano): support Android library applications 2 weeks ago
..
cpp-src feat(android): add native Android application example with complete UI framework 1 month ago
java/com/swoole/typephp feat(android): add native Android application example with complete UI framework 1 month ago
php-src feat(android): add native Android application example with complete UI framework 1 month ago
.gitignore feat(android): add native Android application example with complete UI framework 1 month ago
AndroidManifest.xml feat(android): add native Android application example with complete UI framework 1 month ago
README.md feat(nano): support Android library applications 2 weeks ago
android.yml feat(android): add native Android application example with complete UI framework 1 month ago
build-app.sh feat(nano): support Android library applications 2 weeks ago
install-app.sh feat(android): add native Android application example with complete UI framework 1 month ago

README.md

TypePHP Android native app

This example compiles PHP into a self-contained Android arm64-v8a shared library and packages a signed APK using the Android SDK command-line tools. The TypePHP code owns the control layout, name input, click counter, reset behavior, and event dispatch. Java only supplies the Activity lifecycle and a generic native View bridge. It does not require Gradle or Android Studio.

Prerequisites:

  • Android SDK Platform/Build Tools 36
  • Android NDK r27 or newer
  • JDK with javac and keytool
  • the compiler Composer dependencies, including php-nano and PHPX sources

Build:

export ANDROID_SDK_ROOT=/home/swoole/soft/android-sdk
export ANDROID_NDK_HOME=/home/swoole/soft/android-ndk-r27d
export PHPX_HOME=/path/to/phpx
./build-app.sh --nano

tpc.php itself still runs dynamically on the host PHP. --nano applies to the generated JNI shared library, which compiles the selected php-nano and PHPX sources directly and does not require a prebuilt Android libphp.a or libphpx.a. For a non-Nano build, additionally set PHPX_ANDROID_SDK_DIR to the SDK produced by phpx/sdk/build-native.sh and run ./build-app.sh without --nano.

The result is dist/typephp-android-hello-debug.apk. With an arm64 Android device connected and USB debugging enabled, install and launch it using:

./install-app.sh