无法从Windows解析Qt应用程序构建的Gradle 您所在的位置:网站首页 gradle-33-allzip 无法从Windows解析Qt应用程序构建的Gradle

无法从Windows解析Qt应用程序构建的Gradle

#无法从Windows解析Qt应用程序构建的Gradle| 来源: 网络整理| 查看: 265

我正在尝试将一个安卓应用程序(С++/Qt)从Windows编译到一个虚拟的Android上。

Android SDK:31 (Android 12)

NDK:21.3.6528147

Qt:5.15.2

语言:C++17

显然,编译是针对x86_64处理器的。

Android包生成时编译中断,编译输出如下:

05:00:15: The process "C:\Users\adzol\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" exited normally. 05:00:15: Starting: "D:\Qt\5.15.2\android\bin\androiddeployqt.exe" --input C:/Users/adzol/Projects/build-posiflora-pos-Android_Qt_5_15_2_Clang_Multi_Abi_x86_64-Debug/florist/android-florist-deployment-settings.json --output C:/Users/adzol/Projects/build-posiflora-pos-Android_Qt_5_15_2_Clang_Multi_Abi_x86_64-Debug/florist/android-build --android-platform android-31 --jdk "C:/Program Files/java-se-8u42-ri" --gradle Generating Android Package Input file: C:/Users/adzol/Projects/build-posiflora-pos-Android_Qt_5_15_2_Clang_Multi_Abi_x86_64-Debug/florist/android-florist-deployment-settings.json Output directory: C:/Users/adzol/Projects/build-posiflora-pos-Android_Qt_5_15_2_Clang_Multi_Abi_x86_64-Debug/florist/android-build/ Application binary: florist Android build platform: android-31 Install to device: No Warning: QML import could not be resolved in any of the import paths: Pos.Controllers Warning: QML import could not be resolved in any of the import paths: Pos.Managers Warning: QML import could not be resolved in any of the import paths: Pos.Helpers Warning: QML import could not be resolved in any of the import paths: Pos.Models Warning: QML import could not be resolved in any of the import paths: Pos.Enums Warning: QML import could not be resolved in any of the import paths: Pos.DateTimeUtils Warning: QML import could not be resolved in any of the import paths: QZXing Warning: QML import could not be resolved in any of the import paths: Clipboard Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils Starting a Gradle Daemon, 1 incompatible and 11 stopped Daemons could not be reused, use --status for details FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android-build'. > Could not resolve all files for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:3.6.3. Required by: project : > Could not resolve com.android.tools.build:gradle:3.6.3. > Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom'. > Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom'. > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty > Could not resolve com.android.tools.build:gradle:3.6.3. > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom'. > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom'. > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty * 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

我可以看到GET请求失败了,但是第一个URL (https://maven.google.com/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom)是可行的,我看到了一个.pom文件。问题是我如何使用这些文件?但是,第二个URL返回404。

有几个建议,比如this one,建议用maven { url 'https://maven.google.com' }代替goolge()。所以我build.gradle现在看起来是这样的:

buildscript { repositories { maven { url 'https://maven.google.com' } // Here was google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.5.1' } } repositories { maven { url 'https://maven.google.com' } // Here was google() too jcenter() } apply plugin: 'com.android.application' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) } android { compileSdkVersion androidCompileSdkVersion.toInteger() buildToolsVersion '31.0.0' sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] res.srcDirs = [qt5AndroidDir + '/res', 'res'] resources.srcDirs = ['src'] renderscript.srcDirs = ['src'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } } tasks.withType(JavaCompile) { options.incremental = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } lintOptions { abortOnError false } // Do not compress Qt binary resources file aaptOptions { noCompress 'rcc' } defaultConfig { resConfig "en" minSdkVersion = 21 targetSdkVersion = 31 } }

在用google()替换maven { url 'https://maven.google.com' }之前,这两个URL都不可用:它们相应地返回404和403错误代码。

而且,为了更好地衡量,我的gradle.properties文件:

org.gradle.jvmargs=-Xmx512m android.bundle.enableUncompressedNativeLibs=false androidBuildToolsVersion=31.0.0 androidCompileSdkVersion=31 buildDir=build qt5AndroidDir=D:/Qt/5.15.2/android/src/android/java qtMinSdkVersion=21 qtTargetSdkVersion=31

老实说,我现在不知道该往哪里挖了。任何帮助都是非常感谢的。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有