Start skia on android emulator avd.

104 views
Skip to first unread message

Joaquín Luis Monleón Irisarri

unread,
May 4, 2022, 3:22:32 PM5/4/22
to skia-discuss
Hi.

I'm having trouble using skia in an Android NativeActivity app from the android emulator (avd).

I Clone the skia origin/main branch in commit fe01e985a7.

To generate libskia.so for the different architectures I ran the following instructions.

bin/gn gen out/x86   --args='is_debug=true ndk_api=18 is_component_build=true ndk="/home/ximo/Android/Sdk/ndk/23.1.7779620" target_cpu="x86"'
bin/gn gen out/x64   --args='is_debug=true ndk_api=21 is_component_build=true ndk="/home/ximo/Android/Sdk/ndk/23.1.7779620" target_cpu="x64"'
bin/gn gen out/arm   --args='is_debug=true ndk_api=18 is_component_build=true ndk="/home/ximo/Android/Sdk/ndk/23.1.7779620" target_cpu="arm"'
bin/gn gen out/arm64 --args='is_debug=true ndk_api=21 is_component_build=true ndk="/home/ximo/Android/Sdk/ndk/23.1.7779620" target_cpu="arm64"'


ninja -C out/x86
ninja -C out/x64
ninja -C out/arm
ninja -C out/arm64


I'm having the problem with the android x86 emulator, when I run the code having this line:

sk_sp<const GrGLInterface> fInterface = GrGLMakeNativeInterface();

The application crashes with this trace:

05-04 21:01:02.788 2815-2815/com.example.native_activity E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.native_activity/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.example.native_activity-1/libnative-activity.so
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
        at android.app.ActivityThread.access$600(ActivityThread.java:141)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.example.native_activity-1/libnative-activity.so
        at android.app.NativeActivity.onCreate(NativeActivity.java:184)
        at android.app.Activity.performCreate(Activity.java:5133)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
        at android.app.ActivityThread.access$600(ActivityThread.java:141) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:5103) 
        at java.lang.reflect.Method.invokeNative(Native Method) 


The app runs fine on a real device or on the emulator if I comment out the line.

Any help getting skia to work on the android emulator would be a great help.

Thank you very much.

Reply all
Reply to author
Forward
0 new messages