rust-mobile / rust-android-examples

Various standalone Rust Android examples
127 stars 22 forks source link

attempt to run on genymotion android emulator #5

Open tkkcc opened 1 year ago

tkkcc commented 1 year ago

trying to run agdk-eframe demo on emulator, android 7.0.

  1. I first set minSdk = 24 in app/build.gradle for android 7.0. The logcat gives

    --------- beginning of system
    --------- beginning of crash
    11:31:35.849  E  FATAL EXCEPTION: main
                 Process: co.realfit.agdkeframe, PID: 1797
                 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__system_property_read_callback" referenced by "/data/app/co.realfit.agdkeframe-1/base.apk!/lib/x86/libmain.so"...
                    at java.lang.Runtime.loadLibrary0(Runtime.java:977)
                    at java.lang.System.loadLibrary(System.java:1530)
                    at co.realfit.agdkeframe.MainActivity.<clinit>(MainActivity.java:32)
                    at java.lang.Class.newInstance(Native Method)

    So __system_property_read_callback can't be used.

  2. __system_property_read_callback is enabled in GameActivity.cpp in android-activity with flag __ANDROID_API__ > 26. From doc, __ANDROID_API__ is same as min_sdk_version, I don't know if cargo ndk will respect build.gradle. Also I fail to log the value of __ANDROID_API__. I finally comment out related code. Then I got

    
    --------- beginning of main
    --------- beginning of system
    2023-06-09 13:13:25.188  5110-5110  art                     co.realfit.agdkeframe                I  Late-enabling -Xcheck:jni
    2023-06-09 13:13:25.188  5110-5110  art                     co.realfit.agdkeframe                W  Unexpected CPU variant for X86 using defaults: x86
    2023-06-09 13:13:25.238  5110-5110  art                     co.realfit.agdkeframe                W  Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    2023-06-09 13:13:25.249  5110-5110  GameActivity            co.realfit.agdkeframe                D  GameActivity_register
    2023-06-09 13:13:25.249  5110-5110  GameActivity            co.realfit.agdkeframe                V  Registering com/google/androidgamesdk/GameActivity's 21 native methods...
    2023-06-09 13:13:25.249  5110-5110  GameActivity            co.realfit.agdkeframe                D  loadNativeCode_native
    2023-06-09 13:13:25.249  5110-5110  threaded_app            co.realfit.agdkeframe                V  Creating: 0xf0c36640
    2023-06-09 13:13:25.249  5110-5110  threaded_app            co.realfit.agdkeframe                V  Callbacks set: 0xf0c36668
    2023-06-09 13:13:25.249  5110-5110  threaded_app            co.realfit.agdkeframe                V  Launching android_app_entry in a thread
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  android_app_entry called
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  android_app = 0xd01e46c0
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  config = 0xf0b88140
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  activity = 0xf0c36640
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  assetmanager = 0xf0c22180
    2023-06-09 13:13:25.249  5110-5134  threaded_app            co.realfit.agdkeframe                V  Config: mcc=310 mnc=270 lang=zh cnt=CN orien=1 touch=3 dens=320 keys=2 nav=1 keysHid=1 navHid=0 sdk=24 size=2 long=1 modetype=1 modenight=1
    2023-06-09 13:13:25.253  5110-5110  TAG                     co.realfit.agdkeframe                D  onCreate1: ddddd
    2023-06-09 13:13:25.253  5110-5110  GameActivity            co.realfit.agdkeframe                V  onStart_native
    2023-06-09 13:13:25.253  5110-5110  threaded_app            co.realfit.agdkeframe                V  Start: 0xf0c36640
    2023-06-09 13:13:25.253  5110-5134  threaded_app            co.realfit.agdkeframe                V  activityState=10
    2023-06-09 13:13:25.255  5110-5110  GameActivity            co.realfit.agdkeframe                D  onResume_native
    2023-06-09 13:13:25.255  5110-5110  threaded_app            co.realfit.agdkeframe                V  Resume: 0xf0c36640
    2023-06-09 13:13:25.255  5110-5134  threaded_app            co.realfit.agdkeframe                V  activityState=11
    2023-06-09 13:13:25.271  5110-5110  <no-tag>                co.realfit.agdkeframe                D  static HostConnection *HostConnection::createUnique(): call
    2023-06-09 13:13:25.271  5110-5110  <no-tag>                co.realfit.agdkeframe                D  HostConnection::get() New Host Connection established 0xe0fa89f0, pid 5110, tid 5110
    2023-06-09 13:13:25.272  5110-5110  <no-tag>                co.realfit.agdkeframe                D  HostComposition ext ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_async_unmap_buffer ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_1 
    2023-06-09 13:13:25.272  5110-5110  <no-tag>                co.realfit.agdkeframe                W  Process pipe failed
    2023-06-09 13:13:25.300  5110-5110  threaded_app            co.realfit.agdkeframe                V  WindowInsetsChanged: 0xf0c36640
    2023-06-09 13:13:25.309  5110-5136  libEGL                  co.realfit.agdkeframe                D  Emulator has host GPU support, qemu.gles is set to 1.
    2023-06-09 13:13:25.309  5110-5136  libEGL                  co.realfit.agdkeframe                E  load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
    2023-06-09 13:13:25.309  5110-5136  libEGL                  co.realfit.agdkeframe                D  loaded /system/lib/egl/libEGL_emulation.so
    2023-06-09 13:13:25.311  5110-5136  libEGL                  co.realfit.agdkeframe                D  loaded /system/lib/egl/libGLESv1_CM_emulation.so
    2023-06-09 13:13:25.314  5110-5110  GameActivity            co.realfit.agdkeframe                V  onSurfaceCreated_native
    2023-06-09 13:13:25.314  5110-5110  GameActivity            co.realfit.agdkeframe                D  onSurfaceCreated_native
    2023-06-09 13:13:25.314  5110-5110  threaded_app            co.realfit.agdkeframe                V  NativeWindowCreated: 0xf0c36640 -- 0xe36c0008
    2023-06-09 13:13:25.314  5110-5110  threaded_app            co.realfit.agdkeframe                V  android_app_set_window called
    2023-06-09 13:13:25.314  5110-5134  threaded_app            co.realfit.agdkeframe                V  APP_CMD_INIT_WINDOW
    2023-06-09 13:13:25.314  5110-5110  GameActivity            co.realfit.agdkeframe                D  onSurfaceChanged_native
    2023-06-09 13:13:25.314  5110-5134  vulkan                  co.realfit.agdkeframe                E  invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion") call
    2023-06-09 13:13:25.314  5110-5134  vulkan                  co.realfit.agdkeframe                E  invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion") call
    2023-06-09 13:13:25.314  5110-5134  vulkan                  co.realfit.agdkeframe                I  no Vulkan HAL present, using stub HAL
    2023-06-09 13:13:25.314  5110-5110  threaded_app            co.realfit.agdkeframe                V  NativeWindowResized: 0xf0c36640 -- 0xe36c0008 ( 768 x 1280 )
    2023-06-09 13:13:25.314  5110-5110  GameActivity            co.realfit.agdkeframe                D  onSurfaceRedrawNeeded_native
    2023-06-09 13:13:25.314  5110-5110  threaded_app            co.realfit.agdkeframe                V  NativeWindowRedrawNeeded: 0xf0c36640 -- 0xe36c0008
    2023-06-09 13:13:25.314  5110-5134  vulkan                  co.realfit.agdkeframe                D  searching for layers in '/data/app/co.realfit.agdkeframe-2/lib/x86'
    2023-06-09 13:13:25.314  5110-5134  vulkan                  co.realfit.agdkeframe                D  searching for layers in '/data/app/co.realfit.agdkeframe-2/base.apk!/lib/x86'
    2023-06-09 13:13:25.314  5110-5134  wgpu_hal::vulkan::ins.. co.realfit.agdkeframe                I  Unable to find extension: VK_EXT_debug_utils
    2023-06-09 13:13:25.314  5110-5134  wgpu_hal::vulkan::ins.. co.realfit.agdkeframe                I  Unable to find extension: VK_KHR_get_physical_device_properties2
    2023-06-09 13:13:25.314  5110-5134  wgpu_hal::vulkan::ins.. co.realfit.agdkeframe                I  Unable to find extension: VK_EXT_swapchain_colorspace
    2023-06-09 13:13:25.317  5110-5134  wgpu_hal::vulkan::ins.. co.realfit.agdkeframe                I  Instance version: 0x400000
    2023-06-09 13:13:25.318  5110-5136  libEGL                  co.realfit.agdkeframe                D  loaded /system/lib/egl/libGLESv2_emulation.so
    2023-06-09 13:13:25.319  5110-5134  libEGL                  co.realfit.agdkeframe                E  validate_display:99 error 3008 (EGL_BAD_DISPLAY)
    2023-06-09 13:13:25.319  5110-5134  wgpu_hal::gles::egl     co.realfit.agdkeframe                I  EGL_MESA_platform_surfaceless not available. Using default platform
    2023-06-09 13:13:25.322  5110-5136  <no-tag>                co.realfit.agdkeframe                D  HostConnection::get() New Host Connection established 0xf0ba7140, pid 5110, tid 5136
    2023-06-09 13:13:25.323  5110-5136  <no-tag>                co.realfit.agdkeframe                D  HostComposition ext ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_async_unmap_buffer ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_1 
    2023-06-09 13:13:25.325  5110-5134  wgpu_hal::gles::egl     co.realfit.agdkeframe                I  Display vendor "Android", version (1, 4)
    2023-06-09 13:13:25.325  5110-5134  wgpu_hal::gles::egl     co.realfit.agdkeframe                I      Trying presentation
    2023-06-09 13:13:25.325  5110-5134  <no-tag>                co.realfit.agdkeframe                D  HostConnection::get() New Host Connection established 0xf0ba7280, pid 5110, tid 5134
    2023-06-09 13:13:25.325  5110-5136  OpenGLRenderer          co.realfit.agdkeframe                I  Initialized EGL, version 1.4
    2023-06-09 13:13:25.325  5110-5136  OpenGLRenderer          co.realfit.agdkeframe                D  Swap behavior 1
    2023-06-09 13:13:25.326  5110-5136  OpenGLRenderer          co.realfit.agdkeframe                W  Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    2023-06-09 13:13:25.326  5110-5136  OpenGLRenderer          co.realfit.agdkeframe                D  Swap behavior 0
    2023-06-09 13:13:25.326  5110-5134  <no-tag>                co.realfit.agdkeframe                D  HostComposition ext ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_async_unmap_buffer ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_1 
    2023-06-09 13:13:25.326  5110-5134  wgpu_hal::gles::egl     co.realfit.agdkeframe                I      EGL context: +debug KHR
    2023-06-09 13:13:25.327  5110-5136  EGL_emulation           co.realfit.agdkeframe                D  eglCreateContext: 0xf0b85060: maj 3 min 1 rcv 4
    2023-06-09 13:13:25.328  5110-5134  EGL_emulation           co.realfit.agdkeframe                D  eglCreateContext: 0xf0b853c0: maj 3 min 1 rcv 4
    2023-06-09 13:13:25.392  5110-5110  GameActivity            co.realfit.agdkeframe                D  onSurfaceRedrawNeeded_native
    2023-06-09 13:13:25.392  5110-5110  threaded_app            co.realfit.agdkeframe                V  NativeWindowRedrawNeeded: 0xf0c36640 -- 0xe36c0008
    2023-06-09 13:13:25.395  5110-5134  wgpu_hal::gles::adapter co.realfit.agdkeframe                I  Vendor: Google (NVIDIA Corporation)
    2023-06-09 13:13:25.395  5110-5134  wgpu_hal::gles::adapter co.realfit.agdkeframe                I  Renderer: Android Emulator OpenGL ES Translator (NVIDIA GeForce GTX 1660/PCIe/SSE2)
    2023-06-09 13:13:25.395  5110-5134  wgpu_hal::gles::adapter co.realfit.agdkeframe                I  Version: OpenGL ES 3.1 (4.5.0 NVIDIA 525.89.02)
    2023-06-09 13:13:25.396  5110-5134  wgpu_hal::gles::adapter co.realfit.agdkeframe                I  SL version: OpenGL ES GLSL ES 3.10
    2023-06-09 13:13:25.396  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090d6
    2023-06-09 13:13:25.396  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090d6
    2023-06-09 13:13:25.396  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090da
    2023-06-09 13:13:25.397  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090da
    2023-06-09 13:13:25.398  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090ca
    2023-06-09 13:13:25.398  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090ca
    2023-06-09 13:13:25.399  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090ce
    2023-06-09 13:13:25.400  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090ce
    2023-06-09 13:13:25.401  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090de
    2023-06-09 13:13:25.401  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090de
    2023-06-09 13:13:25.406  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a2b
    2023-06-09 13:13:25.406  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a2b
    2023-06-09 13:13:25.406  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a2d
    2023-06-09 13:13:25.406  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a2d
    2023-06-09 13:13:25.409  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a30
    2023-06-09 13:13:25.409  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008a30
    2023-06-09 13:13:25.410  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090de
    2023-06-09 13:13:25.410  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090de
    2023-06-09 13:13:25.411  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000082e5
    2023-06-09 13:13:25.411  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000082e5
    2023-06-09 13:13:25.412  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008b4b
    2023-06-09 13:13:25.412  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008b4b
    2023-06-09 13:13:25.413  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008262
    2023-06-09 13:13:25.413  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x00008262
    2023-06-09 13:13:25.413  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090eb
    2023-06-09 13:13:25.413  5110-5134  eglCodecCommon          co.realfit.agdkeframe                E  glUtilsParamSize: unknow param 0x000090eb
    2023-06-09 13:13:25.416  5110-5134  wgpu_core::instance     co.realfit.agdkeframe                I  Adapter Gl AdapterInfo { name: "Android Emulator OpenGL ES Translator (NVIDIA GeForce GTX 1660/PCIe/SSE2)", vendor: 4318, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
    2023-06-09 13:13:25.423  5110-5110  GameActivity            co.realfit.agdkeframe                D  onWindowFocusChanged_native
    2023-06-09 13:13:25.423  5110-5110  threaded_app            co.realfit.agdkeframe                V  WindowFocusChanged: 0xf0c36640 -- 1
    2023-06-09 13:13:25.439  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Created buffer Valid((0, 1, Gl)) with BufferDescriptor { label: Some("egui_uniform_buffer"), size: 16, usage: COPY_DST | UNIFORM, mapped_at_creation: true }
    2023-06-09 13:13:25.442  5110-5134  wgpu_hal::gles::device  co.realfit.agdkeframe                I      Compiled shader NativeShader(5)
    2023-06-09 13:13:25.444  5110-5134  wgpu_hal::gles::device  co.realfit.agdkeframe                I      Compiled shader NativeShader(6)
    2023-06-09 13:13:25.446  5110-5134  wgpu_hal::gles::device  co.realfit.agdkeframe                I      Linked program NativeProgram(4)
    2023-06-09 13:13:25.450  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Created render pipeline Valid((0, 1, Gl)) with RenderPipelineDescriptor { label: Some("egui_pipeline"), layout: Some((0, 1, Gl)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Gl), entry_point: "vs_main" }, buffers: [VertexBufferLayout { array_stride: 20, step_mode: Vertex, attributes: [VertexAttribute { format: Float32x2, offset: 0, shader_location: 0 }, VertexAttribute { format: Float32x2, offset: 8, shader_location: 1 }, VertexAttribute { format: Uint32, offset: 16, shader_location: 2 }] }] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Gl), entry_point: "fs_main_gamma_framebuffer" }, targets: [Some(ColorTargetState { format: Rgba8Unorm, blend: Some(BlendState { color: BlendComponent { src_factor: One, dst_factor: OneMinusSrcAlpha, operation: Add }, alpha: BlendComponent { src_factor: OneMinusDstAlpha, dst_factor: One, operation: Add } }), write_mask: RED | GREEN | BLUE | ALPHA | COLOR | ALL })] }), multiview: None }
    2023-06-09 13:13:25.452  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Created buffer Valid((1, 1, Gl)) with BufferDescriptor { label: Some("egui_vertex_buffer"), size: 20480, usage: COPY_DST | VERTEX, mapped_at_creation: false }
    2023-06-09 13:13:25.454  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Created buffer Valid((2, 1, Gl)) with BufferDescriptor { label: Some("egui_index_buffer"), size: 12288, usage: COPY_DST | INDEX, mapped_at_creation: false }
    2023-06-09 13:13:25.455  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  configuring surface with SurfaceConfiguration { usage: RENDER_ATTACHMENT, format: Rgba8Unorm, width: 768, height: 1280, present_mode: AutoVsync, alpha_mode: Auto }
    2023-06-09 13:13:25.455  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Automatically choosing presentation mode by rule AutoVsync. Chose Fifo
    2023-06-09 13:13:25.455  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Automatically choosing alpha mode by rule Auto. Chose Opaque
    2023-06-09 13:13:25.456   308-339   BufferQueueProducer     surfaceflinger                       E  [SurfaceView - co.realfit.agdkeframe/co.realfit.agdkeframe.MainActivity] connect: already connected (cur=1 req=1)
    2023-06-09 13:13:25.456  5110-5134  libEGL                  co.realfit.agdkeframe                E  eglCreateWindowSurface: native_window_api_connect (win=0xe36c0008) failed (0xffffffea) (already connected to another API?)
    2023-06-09 13:13:25.456  5110-5134  libEGL                  co.realfit.agdkeframe                E  eglCreateWindowSurface:464 error 3003 (EGL_BAD_ALLOC)
    2023-06-09 13:13:25.456  5110-5135  RustStdoutStderr        co.realfit.agdkeframe                I  thread '<unnamed>' panicked at 'Error in Surface::configure: invalid surface', /home/bilabila/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.14.2/src/backend/direct.rs:274:9
    2023-06-09 13:13:25.456  5110-5135  RustStdoutStderr        co.realfit.agdkeframe                I  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    2023-06-09 13:13:25.456  5110-5134  wgpu_core::hub          co.realfit.agdkeframe                I  Dropping Global
    2023-06-09 13:13:25.461  5110-5134  wgpu_core::device       co.realfit.agdkeframe                I  Destroying 0 command encoders
    --------- beginning of crash
    2023-06-09 13:13:25.465  5110-5134  RustPanic               co.realfit.agdkeframe                E  Error in Surface::configure: invalid surface
    2023-06-09 13:13:25.465  5110-5134  libc                    co.realfit.agdkeframe                A  Fatal signal 6 (SIGABRT), code -6 in tid 5134 (Thread-2)
    2023-06-09 13:13:25.519  5142-5142  DEBUG                   debuggerd                            A  pid: 5110, tid: 5134, name: Thread-2  >>> co.realfit.agdkeframe <<<
    2023-06-09 13:13:25.520  5142-5142  DEBUG                   debuggerd                            A      #05 pc 00e0c2b4  /data/app/co.realfit.agdkeframe-2/base.apk (offset 0x74a000)
    2023-06-09 13:13:25.778   606-657   InputDispatcher         system_server                        E  channel 'cb3d708 co.realfit.agdkeframe/co.realfit.agdkeframe.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

The first error is some `glUtilsParamSize: unknow param 0x000090da`, then `E  eglCreateWindowSurface: native_window_api_connect (win=0xe36c0008) failed (0xffffffea) (already connected to another API?)`. I upgrade wgpu to latest 0.16.1, no help. There is a related opened issue https://github.com/gfx-rs/wgpu/issues/2384 .

Currently, I can't run this demo on genymotion android 7.0 or 11.0(same error). I can play some unity games on them, so the gles libs on device is ok i think. 
rib commented 1 year ago

We don't currently have a good way for defining what api level we want to compile native code with when building with cargo.

Some crates like the ndk crate expose cargo features like api-level-24, api-level-25... and we could do something similar in android-activity but that's far from ideal because most applications should try to avoid depending on android-activity directly if they can avoid it and instead get android-activity via a framework like winit or egui.

I had been wondering if we could maybe establish an environment variable convention, since cargo doesn't really provide any general way to pass around global features that need to be honored consistently.

It would be painful to have to expose lots of android api level features via crates like Winit and Egui and then ensuring that every crate forwards those recursively from crate to crate.

More specifically here though; cargo ndk has no understanding of Gradle or anything in build.gradle but it does have its own -p/--platform argument that can be used to specify the api level. This works in terms of choosing what suffix to add to the end of the clang wrapper script, which affects the --target argument passed to clang.

Perhaps you can try running with something like cargo ndk -p 24 build

This said though; Android 7 is very old at this point and I'm not sure what the chances are of being able to run agdk-eframe on that old of an Android version. Maybe if you can convince wgpu to run on GLES2 then it might work though.

tkkcc commented 1 year ago

android7 support gles3 as i know. the problem is same on android 11 as i said.

tkkcc commented 1 year ago

suprisingly! after i switch to the default glow backend, android 7 and 11 emulator both works well! (except ime).

tkkcc commented 1 year ago

I tried cargo ndk -p 24, it does not change __ANDROID_API__. __ANDROID_API__ is always 10000.