Frezrik / Jiagu

Android apk jiagu
Apache License 2.0
239 stars 99 forks source link

Support x86 emulator with ARMv7 lib only #8

Closed ghost closed 2 years ago

ghost commented 2 years ago

It seems dlopen fails if running an app with ARMv7 lib only on x86 emulator Memuplay. I don't want to support x86 natively because most apps no longer provides x86 libs, therefore it is not possible to support x86 natively because it will cause crash due to missing x86 libs

It would be great if everything works on ARM translation side

08-06 09:17:05.657 I/InputDispatcher(572): Dropping event because there is no touchable window at (408, 402).
08-06 09:17:05.659 D/houdini (21813): [21813] Added shared library /data/user/0/com.frezrik.jiagu/.jiagu/libjiaguv1.so for ClassLoader by Native Bridge.
08-06 09:17:05.659 D/NDK_JIAGU(21813): SDK_INT = 25
08-06 09:17:05.660 D/gralloc_gmin(269): gralloc_alloc: Creating ashmem region of size 3686400
08-06 09:17:05.661 D/NDK_JIAGU(21813): init done! quick_on_stack_replace = 0xc121000, quick_on_stack_back = 0xaf00f090
08-06 09:17:05.661 D/NDK_JIAGU(21813): [-]getDex
08-06 09:17:05.765 D/NDK_JIAGU(21813): [-]loadDex
08-06 09:17:05.772 D/NDK_JIAGU(21813): app name: com.frezrik.jiagu.MyApp
08-06 09:17:05.772 E/NDK_JIAGU(21813): [-]get /system/lib/libart.so handle failed:dlopen failed: library "/system/lib/libart.so" is not accessible for the namespace "(anonymous)"
08-06 09:17:05.773 D/AndroidRuntime(21813): Shutting down VM
08-06 09:17:05.773 E/AndroidRuntime(21813): FATAL EXCEPTION: main
08-06 09:17:05.773 E/AndroidRuntime(21813): Process: com.frezrik.jiagu, PID: 21813
08-06 09:17:05.773 E/AndroidRuntime(21813): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.frezrik.jiagu/com.frezrik.jiagu.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.frezrik.jiagu.MainActivity" on path: DexPathList[[zip file "/data/app/com.frezrik.jiagu-1/base.apk"],nativeLibraryDirectories=[/data/app/com.frezrik.jiagu-1/lib/arm, /data/app/com.frezrik.jiagu-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2568)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread.-wrap12(ActivityThread.java)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.os.Looper.loop(Looper.java:154)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread.main(ActivityThread.java:6121)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at java.lang.reflect.Method.invoke(Native Method)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
08-06 09:17:05.773 E/AndroidRuntime(21813): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.frezrik.jiagu.MainActivity" on path: DexPathList[[zip file "/data/app/com.frezrik.jiagu-1/base.apk"],nativeLibraryDirectories=[/data/app/com.frezrik.jiagu-1/lib/arm, /data/app/com.frezrik.jiagu-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
08-06 09:17:05.773 E/AndroidRuntime(21813):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
08-06 09:17:05.773 E/AndroidRuntime(21813):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2558)
08-06 09:17:05.773 E/AndroidRuntime(21813):     ... 9 more
ghost commented 2 years ago

Even I tried to use path /system/lib/arm/libart.so which is the arm translation lib, still same error :(

image

ghost commented 2 years ago

Nevermind, just load x86 lib directly even app support arm only and it actually worked. I'm dumb lol