-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
qt android demo出错 #760
Comments
PS C:\Users\76441\Desktop\demo\appdemo> xmake -D stack traceback: |
这个我记得dev上已经修复了才对,你是用的最新的么 更新到dev试试 xmake update dev |
我用Windows xmake二进制 update dev好像不能自动切换更新 我之前都是人工更新对应的lua文件 ,回头我更新下这个文件试试 |
update dev会从ci拉安装包更新安装 应该可以的才对,除非下载失败了 如果原本就是最近版本 core没动 可以尝试仅更新lua xmake update -s dev |
是不是权限不够写入c盘失败了。。可以开个管理员终端更新下试试,不行你就自己 从ci上下载安装包装吧:https://ci.appveyor.com/api/buildjobs/4r0p1378iwekhl9a/artifacts/xmake-installer.exe |
android.lua 在写入 android-deployment-settings.json 需要将 \ 转换成 / 否则 在Windows运行时候 会提示找不到SDK "android-deployment-settings.json")
local content=format([[
{
"description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
"qt": "%s",
"sdk": "%s",
"ndk": "%s",
"sdkBuildToolsRevision": "%s",
"toolchain-prefix": "llvm",
"tool-prefix": "llvm",
"toolchain-version": "%s",
"ndk-host": "%s",
"target-architecture": "%s",
"qml-root-path": "%s",
"stdcpp-path": "%s",
"useLLVM": true,
"application-binary": "%s"
}]], qt.sdkdir, android_sdkdir, ndk, android_build_toolver, ndk_toolchains_ver, ndk_host, target_arch, os.projectdir(), stdcpp_path, target:targetfile());
content=string.gsub( content,"\\","/")
io.writefile(android_deployment_settings,content ) |
你这样全局改,容易干扰其他非路径值,而且linux下 估计是在json里面,需要对''做转义才行,你先改成这样试试呢,如果ok我回头调整下: local function _escape_path(p)
return os.args(p, {escape = true})
end
io.writefile(android_deployment_settings, format([[
{
"description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
"qt": "%s",
"sdk": "%s",
"ndk": "%s",
"sdkBuildToolsRevision": "%s",
"toolchain-prefix": "llvm",
"tool-prefix": "llvm",
"toolchain-version": "%s",
"ndk-host": "%s",
"target-architecture": "%s",
"qml-root-path": "%s",
"stdcpp-path": "%s",
"useLLVM": true,
"application-binary": "%s"
}]], _escape_path(qt.sdkdir), _escape_path(android_sdkdir), _escape_path(ndk), android_build_toolver, ndk_toolchains_ver, ndk_host, target_arch, _escape_path(os.projectdir()), _escape_path(stdcpp_path), _escape_path(target:targetfile()))) |
试了一下 可以了 ,不过这个编译过程还是有其他过程,有时候可以有时候不行 [100%]: generating.qt.app appdemo.apk
E:\Qt\Qt5.12.7\5.12.7\android_armv7\bin\androiddeployqt.exe --input build\.qt\app\android\appdemo\android-deployment-settings.json --output build\.qt\app\android\appdemo\android-build --android-platform android-28 --jdk "C:\\Program Files (x86)\\Java\\jdk1.8.0_71" --gradle --no-gdbserver
Generating Android Package
Input file: build\.qt\app\android\appdemo\android-deployment-settings.json
Output directory: C:/Users/76441/Desktop/demo/appdemo/build/.qt/app/android/appdemo/android-build/
Application binary: build\android\armeabi-v7a\release\libappdemo.so
Android build platform: android-28
Install to device: No
-- Skipping E:/Qt/Qt5.12.7/5.12.7/android_armv7/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so.
-- Skipping E:/Qt/Qt5.12.7/5.12.7/android_armv7/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so.
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
E:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/bin\llvm-strip.exe:
error: unknown argument '-strip-all'
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android-build'.
> Cannot convert URL 'E:QtQt5.12.75.12.7android_armv7/src/android/java/res' to
a file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
Building the android package failed!
-- For more information, run this command with --verbose.
error: execv(E:\Qt\Qt5.12.7\5.12.7\android_armv7\bin\androiddeployqt.exe --input build\.qt\app\android\appdemo\android-deployment-settings.json --output build\.qt\app\android\appdemo\android-build --android-platform android-28 --jdk "C:\\Program Files (x86)\\Java\\jdk1.8.0_71" --gradle --no-gdbserver) failed(14) 可能跟androiddeployqt.exe传递的参数有关,我在QtCreator都是正常的,NDK与SDK版本应该没问题 |
|
_escape_path这个patch我merge进去了,dev上
这个你自己捣鼓下吧,当初搞完mac上部署,win上一直没有环境测试(之前也有人反馈过 #404 #571 )。 你可以自己对比下qt生层的json和xmake生成的差异,然后调整下 https://github.com/xmake-io/xmake/blob/master/xmake/rules/qt/deploy/android.lua |
好的 |
目前测试下来基本可以用,NDK版本需要选择Android studio SDK目录中的 ndk-build,不然有时候编译不过去,原因未知, 2使用xmake -v基本编译成功 比使用xmake 经常编译失败,原因未知
或者
xmake install 在安装apk文件时,如果PC有模拟器,或者adb检测到不止一个设备时,自动安装将会失败,是否考虑 安装完成后直接启动Apk? |
xmake -j1 强制单任务执行试试
可以在自定义xmake run里面搞,你可以先在你自己的target/on_run里面弄下。。 |
分别使用了 xmake -j1 xmake xmake -v 只有最后一个是成功的,
|
你可以跟下core/base/os.lua里面 os.runv 部分看看对比下,加-v和不加的唯一区别是,加-v用了os.execv 不加就用的 os.runv 而这两的区别就是os.runv内部做了重定向处理,可以看看是否这个重定向导致 Lines 607 to 616 in 2aec1cf
|
改成 local ok, errors = os.execv(program, argv, opt)可以了
|
xmake -v 原本就是走的这个,说明是可以的,关键是为啥os.runv不行,你得看下,os.runv 最终走的也是 os.execv。。 可以临时改下os.runv ,比如去掉重定向看看是否ok,比如ok返回值看看,还有里面的 argv参数可以 utils.dump(argv)对比下 看看 |
stdout stderr,有一个在都会编译失败 |
我在execv中 打开进程的参数dump下来,就重定向差别 其他看起来都一样
|
那就是重定向了,androiddeployqt 执行就会出问题。。这个xmake也没办法哈。。你可以试下 手动拼下完整命令 在cmd下 重定向执行看看 是否也会失败。 |
可以在os.runv开启重定向,同时执行 androiddeployqt 的时候,追加 |
线索很多,看不懂
|
command line 是这么写的 成功!
|
那就不知道了,不行你就先xmake -v 这么用着吧,回头有时间我装下qt环境看看 不过得稍微等段时间 |
你这的case我暂时没法复现,不过我装了个win qt 5.14的最新版本,即使不加-v也能正常生成Apk成功了。。 不过,话说qt 5.14又大改过了整个结构(lib库命名也变了,deploy.json的参数设置也变了不少),我做了很多的适配才搞定 我现在暂时没磁盘空间再去重装5.12了,装个5.14我清理了很久才腾出空间来装。。不行也可以升级到最新5.14的qt试试 |
这个先这样吧,5.14上应该可以了,这边实在没空间再去整个5.12来试了。最近要封板了 暂时不动了。 |
xmake -v
configure
{
sh = E:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++
ndk = E:/android-ndk-r21
ndk_stdcxx = true
host = windows
sdk = C:/Users/76441/AppData/Local/Android/Sdk
buildir = build
ndk_toolchains_ver = 4.9
cross = arm-linux-androideabi-
ndk_sdkver = 21
arch = armeabi-v7a
build_toolver = 29.0.3
ccache = true
gcc_toolchain = E:\android-ndk-r21\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64
mode = release
qt_sdkver = 5.12.7
cxx = E:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++
bin = E:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin
ld = E:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++
kind = static
ndkver = 21
android_sdk = C:/Users/76441/AppData/Local/Android/Sdk
plat = android
qt = E:\Qt\Qt5.12.7\5.12.7\android_armv7
}
error: ...mdir\core\sandbox\modules\import\core\base\scheduler.lua:47: attempt to index field 'progress' (a number value)
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:787: in function 'raise'
...mdir\core\sandbox\modules\import\core\base\scheduler.lua:47: in function 'co_start_named'
@programdir\modules\private\async\runjobs.lua:185: in function <@programdir\modules\private\async\runjobs.lua:144>
[C]: in function 'trycall'
@programdir\core\base\scheduler.lua:423: in function 'co_group_begin'
...mdir\core\sandbox\modules\import\core\base\scheduler.lua:85: in function 'co_group_begin'
@programdir\modules\private\async\runjobs.lua:144: in function 'runjobs'
@programdir\actions\build\build.lua:221: in function 'build'
@programdir\actions\build\main.lua:116: in function <@programdir\actions\build\main.lua:111>
[C]: in function 'trycall'
@programdir\core\sandbox\modules\try.lua:121: in function 'try'
@programdir\actions\build\main.lua:110: in function <@programdir\actions\build\main.lua:83>
[C]: in function 'load'
@programdir\core\base\task.lua:520: in function 'run'
@programdir\core\main.lua:259: in function 'cotask'
@programdir\core\base\scheduler.lua:317: in function <@programdir\core\base\scheduler.lua:315>
The text was updated successfully, but these errors were encountered: