Build failed for Android studio new project
Error information
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'.
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'
##The solution
is to build.gradle The buildscript and allprojects in are changed to the following configuration
this is the original configuration
Change to the following code:
buildscript {
repositories {
// maven
def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
def abroad = "http://central.maven.org/maven2/"
// First download the jar from the url if not found, then look in the artifactUrls
maven {
url cn
artifactUrls abroad
}
maven { url "http://maven.aliyun.com/nexus/content/repositories/jcenter"}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
// maven
def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
def abroad = "http://central.maven.org/maven2/"
// First download the jar from the url if not found, then look in the artifactUrls
maven {
url cn
artifactUrls abroad
}
maven { url "http://maven.aliyun.com/nexus/content/repositories/jcenter"}
google()
}
}
Similar Posts:
- [Solved] Gradle Error: Could not resolve all dependencies for configuration ‘:detachedConfiguration7
- [Solved] Missing artifact com. oracle:ojdbc6 : jar:11.2.0.1.0 Problem solving ojdbc package pom.xml error
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- Could not find com.android.tools.build:gradle:3.3.0.
- Failure to find … was cached in the local repository, resolution will not be reattempted until the update interval of public has elapsed or updates are forced
- [Solved] Android Studio Error: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
- AS Import Project Error: Plugin with id ‘com.android.application’ not found.
- [Solved] Android Warning: Gradle DSL method not found: ‘android()’
- Error:(1, 0) Plugin with id ‘android’ not found.
- From building nexus to building Maven project