所以我为Android创建了一个Qt项目,但每当我尝试构建它时,我都会遇到异常。我甚至尝试在命令行中运行gradlew文件,结果相同。无论我在网上看哪,它似乎都是https://docs.gradle.org/current/userguide/userguide_single.html#properties第12.3节中指出的代理或网络问题。我用两个不同的网络进行了双重检查,并且我没有使用代理服务器。
这是自动生成的build.gradle(它有什么问题吗?)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
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']
}
}
lintOptions {
abortOnError false
}
}
任何指针或想法都将不胜感激!
[编辑]
堆栈追踪:
C:\Users\fcente1a\Documents\build-and_test-Android_for_armeabi_v7a_GCC_4_9_Qt_5_
9_0_for_Android_armv72-Debug\android-build>gradlew --verbose
Downloading https://services.gradle.org/distributions/gradle-3.4-bin.zip
Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1769)
at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:124
)
at sun.security.ssl.Handshaker.kickstart(Handshaker.java:1067)
at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:
1487)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
java:1351)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403
)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387
)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:
559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLCo
nnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Http
sURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:60)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
C:\Users\fcente1a\Documents\build-and_test-Android_for_armeabi_v7a_GCC_4_9_Qt_5_
9_0_for_Android_armv72-Debug\android-build>
[第二次修改]
将网址更改为http(不安全)或让gradlew获取本地文件后,我得到了这个:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android-build'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.3.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Connection reset
答案 0 :(得分:2)
看起来你在
之后就遇到了错误正在下载https://services.gradle.org/distributions/gradle-3.4-bin.zip
所以我只是尝试通过cURL来打击它,
$curl --head https://services.gradle.org/distributions/gradle-3.4-bin.zip
HTTP/1.1 301 Moved Permanently
Date: Fri, 02 Jun 2017 20:13:00 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Fri, 02 Jun 2017 21:13:00 GMT
Location: https://downloads.gradle.org/distributions/gradle-3.4-bin.zip
Server: cloudflare-nginx
CF-RAY: 368d121d6ad9568d-IAD
这显示301重定向,如果下载代码未正确处理,则可以解释Connection reset
。我不知道这个URL的来源,但你可以尝试用新目的地替换它:
https://downloads.gradle.org/distributions/gradle-3.4-bin.zip
回答#2
您可以升级并使用2.3.0
吗?这似乎是最新的is definitely available in Central。