Panduan ini ditujukan untuk native image yang diadaptasi tanpa tag Xposed. Gunakan native Xposed activation component untuk menghindari masalah risk control yang dapat disebabkan oleh library Xposed open source.
1. Lingkup
Gunakan panduan ini untuk mengintegrasikan preloading layanan Xposed atau kemampuan pendamping ke native image yang didukung FoxPhone. Sistem Android yang didukung saat ini:
- AOSP 10
- AOSP 12
Jangan menambahkan dependency Xposed Bridge open source lain secara bersamaan. AAR ini menggunakan namespace API yang telah diadaptasi platform; mencampur library Bridge lain dapat menyebabkan konflik class, kegagalan pemuatan, atau sinyal risk control tambahan.
2. Unduh dependensi integrasi
Unduh AAR yang disediakan platform dan pertahankan nama file xposed-bridge-debug.aar:
xposed-bridge-debug.aar 264.87 KB
- Ukuran file: 271231 bytes (sekitar 264.87 KB)
- SHA-256:
D9DC538315E875D83357B3986CC27D1F7535BE17D9F3F6E69C2F327C9A23FC98 - Android API minimum: 26
3. Integrasi demo Android
Langkah 1: Buat proyek Android
- Buat proyek Android di Android Studio.
- Choose the No Activity template to avoid generating unrelated screen code.
- The example can use Java; when using Kotlin, implement the entry class with the same interfaces.

Langkah 2: Tambahkan AAR
- Create a
libsdirectory under the App module. - Place
xposed-bridge-debug.aarinapp/libs/. - Reference it with
compileOnlyinapp/build.gradle.ktsso the Bridge implementation is not packaged into the APK again.
dependencies {
compileOnly(files("libs/xposed-bridge-debug.aar"))
}
For projects using the Groovy DSL, configure it in app/build.gradle:
dependencies {
compileOnly files('libs/xposed-bridge-debug.aar')
}
Langkah 3: Konfigurasikan entry point modul
- Create an
assetsdirectory underapp/src/main/. - Buat file tanpa ekstensi
xposed_init。 - Isi nama lengkap satu kelas entry di setiap baris. Contoh:
com.example.myapplication.Main
The package and class name in xposed_init must exactly match the source code; otherwise the native component cannot find the entry class.
Langkah 4: Implementasikan kelas entry
The API package in the AAR is de.robv.android.examed, not the de.robv.android.xposed package commonly used by open-source Xposed libraries. Entry class example:
package com.example.myapplication;
import de.robv.android.examed.IXposedHookLoadPackage;
import de.robv.android.examed.XposedBridge;
import de.robv.android.examed.callbacks.XC_LoadPackage;
public class Main implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
throws Throwable {
// 必须先限制目标包,避免在所有应用进程中执行初始化逻辑。
if (!"com.example.target".equals(loadPackageParam.packageName)) {
return;
}
XposedBridge.log("Native Xposed module loaded: "
+ loadPackageParam.packageName);
// 在此处实现经过授权的服务预启或伴随逻辑。
}
}
Replace com.example.target with the actual target application package, and keep business logic limited to authorized applications and scenarios.
Langkah 5: Periksa struktur proyek
Setelah konfigurasi, proyek harus berisi setidaknya file berikut:
app/libs/xposed-bridge-debug.aarapp/src/main/assets/xposed_initapp/src/main/java/.../Main.javaor the corresponding Kotlin fileapp/src/main/AndroidManifest.xmlapp/build.gradle.ktsorapp/build.gradle

Langkah 6: Konfigurasikan aturan obfuscation
Jika release build mengaktifkan R8 atau ProGuard, pertahankan kelas entry agar namanya tidak diubah atau dihapus:
-keep class com.example.myapplication.Main { *; }
Jika Anda mengubah package name kelas entry, perbarui juga xposed_init and the obfuscation rules.。
Langkah 7: Build dan verifikasi
- Jalankan Gradle Sync dan pastikan dependency AAR berhasil di-resolve.
- Build the APK and confirm that it contains
assets/xposed_init. - Install the APK on a supported native image instance.
- Enable the module through the FoxPhone native Xposed activation component.
- Launch the target application, check the logs for entry-class output, and verify that the business logic runs only in the target package.
4. Pertanyaan umum
1. Modul tidak berjalan setelah instalasi
Confirm that the instance uses a supported AOSP 10 or AOSP 12 native image, that the module is activated by the native component, and that the fully qualified class name in xposed_init is correct.
2. Antarmuka Xposed tidak ditemukan saat kompilasi
Check that the AAR is in app/libs/, verify the path in the Gradle file, and confirm that the de.robv.android.examed namespace is imported.
3. Paket Release terpasang, tetapi entry tidak berjalan
Check whether R8 or ProGuard changed or removed the entry class, and verify that the obfuscation rules match xposed_init.
4. Muncul kelas duplikat atau konflik Bridge saat runtime
Remove other Xposed Bridge dependencies and confirm that the platform AAR is added with compileOnly and is not packaged into the APK twice.
5. Modul memengaruhi aplikasi non-target
Filter by packageName at the very start of the entry method and return immediately for non-target processes.