Solutions for “Unable to resolve dependency” on building with Android Studio 3.0

Hello, Android Studio users!

I had installed Android Studio 2.3 long time ago, and tried to update it to 3.0 yesterday.
Then, build was failed with the message:

"Unable to resolve dependency"

I’ve struggled with this problem and found a workaround.

On threads of Stack Overflow, it seems many developers have been caught in the same trouble.
So, I write the solutions here.

The cause of this problem

I think previous versions of Android Studio passed some properties to gradle. But the latest version not.
So, we must set some sytemProp parameters in gradle.properties file.

gradle.properties is located in
{Android Studio Project}/gradle.properties

My environments

gradle 4.1
Android Studio 3.0.1
Build #AI-171.4443003, built on November 10, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Error Messages 1

Logs

The below logs were shown.

Solution

The previous versions of Android Studio might pass the following Proxy setting to gradle, but the latest may not.
Settings -> Appearence & Behavior -> System Settings -> HTTP Proxy

So, you should add http and https proxy setting like this.

Ref : https://docs.gradle.org/current/userguide/build_environment.html

Error Messages 2

Logs

After “Error Messages 1” were solved, other error messages were shown.

Solution

Key phrases of the messages are “unable to find valid certification path” and “PKIX path building failed“.
These phrases are shown when an SSL certification file can not be found.

So, I imported some certifications into Android Studio JDK cacerts from Android Studio’s cacerts.

Android Studio’s cacerts may be located in
{your-home-directory}/.AndroidStudio3.0/system/tasks/cacerts

I used the following import command.

$ keytool -importkeystore -v -srckeystore {src cacerts} -destkeystore {dest cacerts}

Example:

The keytool command requires a keystore password.
The default password is “changeit

Next, add trustStore path in gradle.properties file.

I hope your problems will be resolved.