Android Studio 3.5 when importing a project on Gradle wrong solution

wrong description

The new version of Android Studio build error when (this blog using Android Studio 3.5) to import the old Android Studio project, the following tips in the resolution process:

  • ERROR: Cause: peer not authenticated
  • ERROR: Could not find com.android.tools.build:gradle:3.5.0

Such import the old project build error, often due to errors caused by Gradle.

problem solved

Different versions of Android Studio dependent Gradle tools, concrete can see: Android Gradle plugin Release Notes . In fact, can not too much trouble, a new Android Studio project, through " File> Project Structure> Project " to inquire into the current version of Android Studio tool used Gradle (Plugin) and Gradle version. As shown below:
Here Insert Picture Description
can see the current version is Gradle Plugin 3.5.0, Gradle version 5.4.1.
Then build.gradle modify the old Android project (Project), modify the "dependencies" of the "classpath" section, as shown below:
Here Insert Picture Description
a modified version of one of the gradle tool, using the latest version currently supported. Modifications here can be solved " ERROR: in the Cause: the peer not the Authenticated " error, but appears " ERROR: Could not the Find com.android.tools.build:gradle:3.5.0 " error.
This error reason is because Google adds Maven repositories, as shown in Figure repositories-- " Google () ", add this new Maven repositories can be in build.gradle, the details can be found in: StackOverflow

postscript

build a high probability error import the old project Gradle occurs because of an error, but can not be completely generalized, depending on specific conditions.

Published 30 original articles · won praise 17 · views 210 000 +

Guess you like

Origin blog.csdn.net/llfjfz/article/details/101288993