您现在的位置是:网站首页> C/C++

QT 开发的Android在Android中常见错误处理

  • C/C++
  • 2023-06-18
  • 921人已阅读
摘要

Java版本问题:Your build is currently configured to use Java 17.0.6 and Gradle 5.6.4.

QtCreator注意NDK版本

关于Qt for android构建的Failed to GetFullPathName错误



Java版本问题:Your build is currently configured to use Java 17.0.6 and Gradle 5.6.4.

2.png

修改JAVA的版本

3.png

Java的安装一般路径

C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08

C:\Program Files\Java\jdk-17

QtCreator输出多个CPU类型代码设置

2.png



注意QTCreator对应的NDK版本

Qt Creator 4.9.0 (Enterprise) 用android-ndk-r19c

qtcreator4.11     用android-ndk-r20b



关于Qt for android构建的Failed to GetFullPathName错误


关于Qt for android构建的Failed to GetFullPathName错误

最近在做Qt for android的项目的过程中,运用Qt的自带的例子编译一个qt for android的APK,发现了一个编译错误如下:


> Task :compileDebugAidl FAILED


aidl.exe E 04-24 16:06:20 25348 25020 io_delegate.cpp:50] Failed to GetFullPathName(C:\Qt\Qt5.14.1\Examples\Qt-5.14.1\widgets\painting\build-fontsampler-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android_90ede6-Debug\android-build\build\generated\aidl_source_output_dir\debug\compileDebugAidl\out\org\kde\necessitas\ministro\IMinistro.java)


FAILURE: Build failed with an exception.


* What went wrong:


Execution failed for task ':compileDebugAidl'.


> 1 exception was raised by workers:


java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: com.android.ide.common.process.ProcessException: Error while executing process E:\android_dll\android-sdk-windows\build-tools\28.0.3\aidl.exe with arguments {-pE:\android_dll\android-sdk-windows\platforms\android-29\framework.aidl -oC:\Qt\Qt5.14.1\Examples\Qt-5.14.1\widgets\painting\build-fontsampler-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android_90ede6-Debug\android-build\build\generated\aidl_source_output_dir\debug\compileDebugAidl\out -IC:\Qt\Qt5.14.1\5.14.1\android\src\android\java\src -IC:\Qt\Qt5.14.1\Examples\Qt-5.14.1\widgets\painting\build-fontsampler-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android_90ede6-Debug\android-build\src\debug\aidl -IC:\Qt\Qt5.14.1\Examples\Qt-5.14.1\widgets\painting\build-fontsampler-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android_90ede6-Debug\android-build\src -IC:\Qt\Qt5.14.1\Examples\Qt-5.14.1\widgets\painting\build-fontsampler-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_1_for_Android_90ede6-Debug\android-build\aidl -dC:\Users\Administrator\AppData\Local\Temp\aidl2993109682987047489.d C:\Qt\Qt5.14.1\5.14.1\android\src\android\java\src\org\kde\necessitas\ministro\IMinistro.aidl}


* 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 9s


1 actionable task: 1 executed


Building the android package failed!


-- For more information, run this command with --verbose.


16:06:20: 进程"C:\Qt\Qt5.14.1\5.14.1\android\bin\androiddeployqt.exe"退出,退出代码 14 。


Error while building/deploying project fontsampler (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.1 for Android))


When executing step "Build Android APK"


刚开始也不知道啥问题,然后翻译了一下Failed to GetFullPathName,发现了是不能获取路径的问题,然后就网上的百度了一下,刚好看到了有位大佬的解决方法,究其原因还是这个构建文件夹的路径和文件名称太长了,导致编译的时候编译器无法获取到准确的路径名,所以可以将构建的路径选择到别的文件夹去。


我之前的构建目录:

4.png



然后就报错,后面将方框里面的构建目录改成了G:\QMLobject 目录下  成功的解决了这个问题


Top