Build an error Android Studio 3.1

After updating Android Studio to 3.1, I encountered an error when loading a new template project.

Try to use and not use this option, But it didn’t work:

maven {
url "https://maven.google.com"
}

During the period, I saw the following message:

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException:
Could not resolve com.android.tools.build: gradle:3.1.0.
<6 internal calls>
... 128 more
Caused by: org.gradle.api.resources.ResourceException:
Could not get resource ' https://dl/google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom' <21 internal calls>
... 133 more
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException:
Could not GET'https://dl/google.com/dl/android/maven2/com/android /tools/build/gradle/3.1.0/gradle-3.1.0.pom'. <16 internal calls>
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to dl.google.com: 433 [dl.google.com/216.58.199.142] failed

build.gradle

apply plugin:'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.am.myapplicationtest"
minSdkVersion 19
targetSdkVersion 27
versionCode 1< br /> versionName "1.0"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}

Screenshots for reference:
enter image description here

Gradle settings
enter image description here

this It is a network problem

I think your problem is caused by a bad network because:

p>

Caused by: org.apache.http.conn.HttpHostConnectException:
Connect to dl.google.com:433 [dl.google.com/216.58.199.142] failed

I encountered a similar problem, and finally I found that the root cause was gradle’s default proxy (not applicable to Android Studio, but applicable to gradle! )

I defined my own proxy settings in gradle.properties, but when I click Sync in Android Studio, my settings do not apply and cause the following error:

Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Install Repository and sync project
Open File
Show in Project Structure dialog

Solution

Finally, I built my application through the command line and set the proxy to solve my problem, as shown below:

gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129

Get this from Gradle proxy configuration, thanks to Guillaume Berche.

After updating Android Studio to 3.1, I encountered an error when loading a new template project.

Try to use and not Use this option, but it doesn’t work:

maven {
url "https://maven.google.com"
}

< p>During the build, I saw the following message:

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException:
Could not resolve com.android. tools.build:gradle:3.1.0.
<6 internal calls>
... 128 more
Caused by: org.gradle.api.resources.ResourceException:
Could not get resource'https ://dl/google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom' <21 internal calls>
... 133 more
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException:
Could not GET'https://dl/google.com/dl/android/maven2/com/android/ tools/build/gradle/3.1.0/gradle-3.1.0.pom'. <16 internal calls>
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to dl.google.com:433 [dl.google.com/216.58.199.142] failed

build.gradle

apply plugin:'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.am.myapplicationtest"
minSdkVersion 19< br /> targetSdkVersion 27
versionCode 1
versionName "1.0"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled fa lse
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}

Screenshots for reference:
enter image description here

Gradle settings
enter image description here

This is a network problem

I think your problem is caused by a bad network, because:

Caused by: org.apache.http.conn.HttpHostConnectException:
Connect to dl.google.com:433 [dl.google.com/216.58.199.142] failed

I encountered a similar problem, and finally I found that the root cause was gradle’s default proxy (not applicable to Android Studio, but for gradle! )

I defined my own proxy settings in gradle.properties, but when I click Sync in Android Studio, my settings do not apply and cause the following error:

Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Install Repository and sync project
Open File
Show in Project Structure dialog

Solution

Finally, I built my application through the command line and set the proxy to solve my problem, as shown below:

gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129

Get this from Gradle proxy configuration, thanks to Guillaume Berche.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3622 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.