環境:mac 10.12.6,Qt Creator 4.4.3,Based on Qt 5.9.3 (Clang 7.0 (Apple), 64 bit),Android Studio2.3.3。
先看跑起來的效果,選擇對應模擬器後即可看到最終效果。
這是常見的柱狀圖,還有很多Demo效果。
從 示例 裏面任意選擇一個工程作爲測試。
因爲開發安卓需要進行相關配置(開發ios不需要),所以按照下圖進入配置頁面。
下圖是配置頁面,NDK和Ant必須配置,否則報錯。
由於QT支持多平臺,所以要指定運行的平臺,這裏選擇Android.
過程中遇到的問題:
錯誤1:
Exception in thread “main” java.lang.RuntimeException: Timeout of
120000 reached waiting for exclusive access to file:
C:\Users\Narges.gradle\wrapper\dists\gradle-2.2.1-
bin\88n1whbyjvxg3s40jzz5ur27\gradle-2.2.1-bin.zip
解決:在 https://services.gradle.org/distributions/ 下載zip文件放在錯誤提示裏面對應的目錄下即可,並且保證只有這一個zip文件,因爲安裝apk的時候系統會自動解壓。
錯誤2:
\AndroidManifest.xml:4: error: Error: String types not allowed (at ‘configChanges’ with value ‘orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation’).
解決:項目設置中把sdk換成android-21以上