大佬教程收集整理的这篇文章主要介绍了构建项目失败并导致连接重置,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在做的项目是很久以前开发的,并且运行成功。现在,我想再次访问它并运行它以查看一些结果。
当我尝试构建项目时,我收到以下错误和 Connection_reset”消息。
更新的 gradle:app:
plugins{
ID 'com.androID.application'
}
androID {
compileSdkVersion 30
defaultConfig {
applicationID "example.com.thninxnet_00"
minSdkVersion 14
targetSdkVersion 30
versionCode 1
versionname "1.0"
}
buildTypes {
release {
MinifyEnabled false
proguardfiles getDefaultProguardfile('proguard-androID.txt'),'proguard-rules.pro'
}
}
buildToolsversion "30.0.2"
}
dependencIEs {
implementation filetree(include: ['*.jar'],dir: 'libs')
testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
implementation 'com.androID.support:appcompat-v7:23.4.0'
implementation 'com.squareup.piCasso:piCasso:2.5.2'
implementation files('libs/universal-image-loader-1.9.5.jar')
}
更新 gradle:project:
// top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositorIEs {
Google()
jcenter()
}
dependencIEs {
classpath 'com.androID.tools.build:gradle:4.1.1'
// NOTE: Do not place your application dependencIEs here; they belong
// in the indivIDual module build.gradle files
}
}
allprojects {
repositorIEs {
Google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
更新错误:
connection reset
您使用的是 compileSdkVersion
和 targetSdkVersion
的 30
,但您的 buuldToolsVersion
是 25
,所以只是为了兼容性替换:
buildToolsVersion "25.0.1"
与:
buildToolsVersion "30.0.2"
并替换:
apply plugin: 'com.android.application'
与:
plugins{
id 'com.android.application'
}
并告知我们结果。
编辑:
还有Invalidate Caches
:
File -> Invalidate Caches -> Invalidate and Restart
编辑 2:
当 gradle
无法连接到 servers
以检索所需的 libraries
时,可能会发生连接重置,因此您可以做的是:
internet
连接是否稳定,可能是由于互联网连接不稳定。gradle servers
的连接可能被阻止,因此请使用 VPN(会更改您的 IP)并再次尝试重建您的项目。Antivirus
软件或 Firewall
可能阻止了 Android studio
,因此请务必禁用防火墙和防病毒软件并重建您的项目。无法说明后面的错误,但构建期间的连接重置错误有时是由于互联网连接不稳定。也许这种不稳定的互联网连接是同步失败和后续错误的原因。
,google()
已添加到 Gradle v4 中,因此请确保您使用正确的 Gradle 插件版本
请尝试使用
更新您的项目级 Gradle 文件classpath 'com.android.tools.build:gradle:3.5.3'
并在您的 gradle-wrapper.properties
中添加此行
diStributionUrl=\
https\://services.gradle.org/diStributions/gradle-4.1-x-all.zip
或者,在旧版本的 Android studio 中,您可以使用 google()
构造对 @H_270_11@maven 使用等效项,但尝试将其放在 jcenter()
之后
@H_270_11@maven { url 'https://maven.google.com' }
以上是大佬教程为你收集整理的构建项目失败并导致连接重置全部内容,希望文章能够帮你解决构建项目失败并导致连接重置所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。