Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助:AWTK Android SmartWatch.v2-Demo移植运行失败,SDL_CreateWindow返回NULL #3

Open
zfz1120 opened this issue Sep 23, 2021 · 15 comments

Comments

@zfz1120
Copy link

zfz1120 commented Sep 23, 2021

原awtk demoUI编译成功、真机运行成功。各仓库版本均最新

准备移植SmartWatch.v2-Demo至安卓真机,测试运行性能。

修改位置:

  1. awtk/build.json
{
  "name": "demoui",
  "version": "1.0",
  "assets": "../awtk-examples/SmartWatch.v2-Demo/res/assets",
  "author": "[email protected]",
  "copyright": "Guangzhou ZHIYUAN Electronics Co.,Ltd.",
  "themes":["default"],
  "web": {
    "app_type": "c",
    "assets": "design",
    "sources": [
      "demos/assets.c",
      "demos/demo_ui_app.c"
    ],
    "config": {
      "fontScale": "0.8",
      "defaultFont": "sans"
    }
  },
  "android": {
    "app_name": "org.zlgopen.demoui",
    "sources": [
      "../awtk-examples/SmartWatch.v2-Demo/src/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/src/application/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/application/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/src/custom_widgets/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/custom_widgets/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/src/watch/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/watch/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/src/slide_appliction/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/slide_appliction/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/src/common/*.c", 
      "../awtk-examples/SmartWatch.v2-Demo/src/common/*.h", 
      "../awtk-examples/SmartWatch.v2-Demo/res/assets.inc",
      "../awtk-examples/SmartWatch.v2-Demo/res/assets_default.inc"
    ]
  },
  "ios": {
    "app_name": "org.zlgopen.demoui",
    "sources": [
      "demos/assets.c",
      "demos/demo_ui_app.c",
      "demos/vg_common.inc",
      "res/assets.inc",
      "res/assets/__assets_dark.inc",
      "res/assets/__assets_default.inc"
    ]
  }
}
  1. 修改awtk/project.json
{
  "name": "awtk-demos",
  "entry": "home_page",
  "assets": {
    "activedTheme": "default",
    "outputDir": "res",
    "loadFrom": "any",
    "screenDPR": "x1",
    "const": "resource_data",
    "defaultLanguage": "zh",
    "defaultCountry": "CN",
    "themes": {
      "default": {
        "activedSystemBar": "system_bar",
        "activedBottomSystemBar": "system_bar_b",
        "packaged": true,
        "fonts": {
          "default": {
            "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
          },
          "ap": {
            "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
          },
          "default_full": {
            "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
          },
          "trado": {
            "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
          }
        },
        "lcd": {
          "width": "800",
          "height": "480",
          "colorDepth": "16bit",
          "colorFormat": "BGR(A)"
        }
      }
    }
  },
  "creator": {
    "name": "AWTK Designer",
    "version": "1.0.0"
  },
  "awtkRoot": "."
}
  1. Android环境如下:
  • Android studio 3.6
  • NDK 18
  • Cmake 3.6
  • Gradle Plugin 3.1.0
  • Gradle Version 4.4
  • compileSdkVersion 27
  • buildToolsVersion "27.0.3"
  • minSdkVersion 19
  • targetSdkVersion 23
  • 模拟器 Android 4.4
  1. 其它采用默认配置、编译通过

  2. 运行失败,log如下

09-23 07:55:53.525 2243-2243/org.zlgopen.demoui E/BluetoothAdapter: Bluetooth binder is null
09-23 07:55:54.075 2243-2258/org.zlgopen.demoui E/libEGL: validate_display:254 error 3008 (EGL_BAD_DISPLAY)
09-23 07:56:39.265 2276-2276/? D/dalvikvm: Not late-enabling CheckJNI (already on)
09-23 07:56:39.315 2276-2276/org.zlgopen.demoui V/SDL: Device: generic_x86
09-23 07:56:39.315 2276-2276/org.zlgopen.demoui V/SDL: Model: Android SDK built for x86
09-23 07:56:39.315 2276-2276/org.zlgopen.demoui V/SDL: onCreate()
09-23 07:56:39.315 2276-2276/org.zlgopen.demoui D/dalvikvm: Trying to load lib /data/app-lib/org.zlgopen.demoui-2/libawtk.so 0xad012410
09-23 07:56:39.325 2276-2276/org.zlgopen.demoui D/dalvikvm: Added shared lib /data/app-lib/org.zlgopen.demoui-2/libawtk.so 0xad012410
09-23 07:56:39.335 2276-2276/org.zlgopen.demoui D/dalvikvm: Trying to load lib /data/app-lib/org.zlgopen.demoui-2/libapp.so 0xad012410
09-23 07:56:39.335 2276-2276/org.zlgopen.demoui D/dalvikvm: Added shared lib /data/app-lib/org.zlgopen.demoui-2/libapp.so 0xad012410
09-23 07:56:39.335 2276-2276/org.zlgopen.demoui D/dalvikvm: No JNI_OnLoad found in /data/app-lib/org.zlgopen.demoui-2/libapp.so 0xad012410, skipping init
09-23 07:56:39.335 2276-2276/org.zlgopen.demoui V/SDL: nativeSetupJNI()
09-23 07:56:39.335 2276-2276/org.zlgopen.demoui V/SDL: AUDIO nativeSetupJNI()
09-23 07:56:39.345 2276-2276/org.zlgopen.demoui V/SDL: CONTROLLER nativeSetupJNI()
09-23 07:56:39.345 2276-2276/org.zlgopen.demoui D/hidapi: Initializing Bluetooth
09-23 07:56:39.355 2276-2276/org.zlgopen.demoui E/BluetoothAdapter: Bluetooth binder is null
09-23 07:56:39.405 2276-2276/org.zlgopen.demoui D/AWTK: Java_org_zlgopen_plugins_PluginManager_init
09-23 07:56:39.405 2276-2276/org.zlgopen.demoui V/AWTK: PluginManager start
09-23 07:56:39.405 2276-2276/org.zlgopen.demoui V/SDL: onResume()
09-23 07:56:39.905 2276-2276/org.zlgopen.demoui V/SDL: surfaceCreated()
09-23 07:56:39.905 2276-2276/org.zlgopen.demoui V/SDL: surfaceChanged()
09-23 07:56:39.915 2276-2276/org.zlgopen.demoui V/SDL: pixel format RGB_565
09-23 07:56:39.915 2276-2276/org.zlgopen.demoui V/SDL: Window size: 480x690
09-23 07:56:39.915 2276-2276/org.zlgopen.demoui V/SDL: Device size: 480x800
09-23 07:56:39.925 2276-2276/org.zlgopen.demoui V/SDL: nativeResume()
09-23 07:56:39.925 2276-2291/org.zlgopen.demoui V/SDL: Running main function SDL_main from library /data/app-lib/org.zlgopen.demoui-2/libapp.so
09-23 07:56:39.925 2276-2291/org.zlgopen.demoui V/SDL: nativeRunMain()
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try /
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try set app_root:/res
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try set app_root:/demos
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try /system/bin
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try set app_root:/system/res
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: try set app_root:/system/demos
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: app_root=
09-23 07:56:39.935 2276-2291/org.zlgopen.demoui D/AWTK: Not found valid assets folder!
09-23 07:56:39.955 2276-2276/org.zlgopen.demoui D/gralloc_ranchu: Emulator without host-side GPU emulation detected. Loading gralloc.default.so from /vendor/lib/hw/gralloc.default.so...
09-23 07:56:39.955 2276-2276/org.zlgopen.demoui D/gralloc_ranchu: gralloc.default.so not found in /vendor. Trying /system/lib/hw/gralloc.default.so...
09-23 07:56:39.965 2276-2291/org.zlgopen.demoui D/AWTK: Init opengl done.
09-23 07:56:39.965 2276-2291/org.zlgopen.demoui E/libEGL: validate_display:254 error 3008 (EGL_BAD_DISPLAY)
09-23 07:56:39.965 2276-2291/org.zlgopen.demoui V/SDL: setOrientation() orientation=7 width=1 height=1 resizable=false hint=
09-23 07:56:39.965 2276-2276/org.zlgopen.demoui V/SDL: onWindowFocusChanged(): true
09-23 07:56:39.975 2276-2291/org.zlgopen.demoui W/SDL/SYSTEM: Assertion failure at SDL_GL_CreateContext_REAL (D:\workspace\Android\awtk-android\build\demoui\app\src\main\cpp\awtk\3rd\SDL\src\video\SDL_video.c:3500), triggered 1 time:
      'window && window->magic == &_this->window_magic'
09-23 07:56:40.295 2276-2276/org.zlgopen.demoui V/SDL: onWindowFocusChanged(): false
09-23 07:56:40.295 2276-2276/org.zlgopen.demoui V/SDL: nativePause()

image

@xianjimli
Copy link
Member

麻烦把json文件贴上文本格式的。

@WNsACE
Copy link

WNsACE commented Sep 23, 2021

模拟器支持 opengles2 吗? SDL 需要使用 opengles2 。或者你可以换真机试一下?

@wanliofficial
Copy link

模拟器支持 opengles2 吗? SDL 需要使用 opengles2 。或者你可以换真机试一下?

小米8真机试过了,一样的错误类型。

修改:NANOVG_BACKEND='AGGE' 后重新编译,一样的错误。

@WNsACE
Copy link

WNsACE commented Sep 23, 2021

按照你的说法,就是换了一个 demo 就不正常了?

@wanliofficial
Copy link

按照你的说法,就是换了一个 demo 就不正常了?

是的,你那边有没有移植好的,测试通过的demo工程,发一个我测试下,谢谢!

@WNsACE
Copy link

WNsACE commented Sep 23, 2021

你们不是说 demoui 是可以正常的吗?这就很奇怪了,你确定 demoui 和手表 demo 的配置以及宏都一样的?手表 demo 本身是和底层没有任何关系的,不应该出现这种问题才对

@wanliofficial
Copy link

你们不是说 demoui 是可以正常的吗?这就很奇怪了,你确定 demoui 和手表 demo 的配置以及宏都一样的?手表 demo 本身是和底层没有任何关系的,不应该出现这种问题才对

awtk下的demoUI在awtk_android下是正常运行的。watch.v2移植仅修改了build.json和project.json,其它均未改动,编译正常,运行失败。或者是watchdemo有引入demoUI未使用的功能导致的??你这边有其它适配的demo可以让我测试一下么,或者你这边方便移植测试下watch.v2

@WNsACE
Copy link

WNsACE commented Sep 23, 2021

我用小米5和OPPO Reno十倍变焦以及公司的测试机,都是可以正常运行的,就是因为手表 demo 限制了分辨率为 800 * 480,所以出现画面偏移不正常的情况,但是项目是可以正常运行起来的,没有出现上述的 SDL 的问题。
IMG20210923200731

IMG20210923182519
我附上 bulid 文件和 apk 的压缩包,bulid 文件需要放在 SmartWatch.v2-Demo 项目下。
apk和bulid文件.zip

@xianjimli
Copy link
Member

模拟器 Android 4.4 可能不行,最低要求6.0。

@zfz1120
Copy link
Author

zfz1120 commented Sep 24, 2021

模拟器 Android 4.4 可能不行,最低要求6.0。

我们的目标设备就是安卓4.4的、、、

@zfz1120
Copy link
Author

zfz1120 commented Sep 24, 2021

我用小米5和OPPO Reno十倍变焦以及公司的测试机,都是可以正常运行的,就是因为手表 demo 限制了分辨率为 800 * 480,所以出现画面偏移不正常的情况,但是项目是可以正常运行起来的,没有出现上述的 SDL 的问题。
IMG20210923200731

IMG20210923182519
我附上 bulid 文件和 apk 的压缩包,bulid 文件需要放在 SmartWatch.v2-Demo 项目下。
apk和bulid文件.zip

收到,我一会测试下,

@zfz1120
Copy link
Author

zfz1120 commented Sep 24, 2021

模拟器 Android 4.4 可能不行,最低要求6.0。

4.4应该没问题吧,我用SDL+LVGL在4.4跑过

@xianjimli
Copy link
Member

要看用的SDL那个版本。

@WNsACE
Copy link

WNsACE commented Sep 24, 2021

你之前说的是 demoui 可以的?其实 demo 是和底层没有关系的,如果是 demoui 没有问题的话,手表的 demo 应该也是没有问题的,而且你说在小米 8 上面运行也不行啊,小米 8 可不是安卓 4.4 的吧,同时我没有测试过安卓 4.4 ,所以不清楚情况,还有一点就是你说 SDL+LVGL 在 4.4 跑过,问题是 SDL 有开启 opengles2 么? (SDL 也是可以支持无硬件加速的)如果我没有记错的话,lvgl 应该都是直接画到 fb 上面的吧(不需要 opengl 加速的)。

@zfz1120
Copy link
Author

zfz1120 commented Sep 25, 2021

你之前说的是 demoui 可以的?其实 demo 是和底层没有关系的,如果是 demoui 没有问题的话,手表的 demo 应该也是没有问题的,而且我没有测试过安卓 4.4 ,所以不清楚情况,还有一点就是你说 SDL+LVGL 在 4.4 跑过,问题是 SDL 有开启 opengles2 么? (SDL 也是可以支持无硬件加速的)如果我没有记错的话,lvgl 应该都是直接画到 fb 上面的吧。

你这可以直接跑起来,没问题,环境也是一样的,你的build和我的build哪里不一样导致的么。有没有详细的JSON配置文件讲解文档啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants