Solution of Error Reporting in android studio New Project

  • 2021-11-24 02:50:29
  • OfStack

android studio Error Reporting for New Construction

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
Required by:
project :app
> Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.0.0-beta1/appcompat-v7-26.0.0-beta1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.0.0-beta1/appcompat-v7-26.0.0-beta1.pom'.
> Connect to dl.google.com:443 [dl.google.com/203.208.46.146] failed: Operation timed out (Connection timed out)

1. Cancel the agent

Preferences- > Appearance & Behavior- > System Settings- > Http Proxy
Select No Proxy

2. Unhide the proxy

Turn off the directory corresponding to the stealth agent on mac: ~/. gradle/gradle. properties

3.
Preferences- > Build,Execution,Deployment- > Gradle, uncheck "offline work" and let studio download it.

4.
Preferences- > Build,Execution,Deployment- > Gradle- > Android Studio
Uncheck Disable embedded Maven Repository

5. Modify bulid. gradle of 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:3.0.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
}

Added in two repository, Alibaba Cloud's mirror image


 maven {
 url 'http://maven.aliyun.com/nexus/content/groups/public/'
 }

sync again, the problem is solved, but if maven is removed, sync can be normal, which is a bit confusing. In the first few steps, my as was originally matched without modification, so I guess it may be that wifi is not good. . .

Knowledge point supplement: Android Studio new project error reporting "" Error occurred during initialization of VM... "Solution

Android Studio new construction error report:

Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap

You encounter following error:

Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap

Reason: The Java virtual machine (JVM) does not have enough memory space.

Solution:

1: Create an gradle. properties file under your personal folder (C:/Users/username/. gradle or ~/. gradle) and add

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

2: Or directly add the following line to the gradle. properties file in Android Studio, and modify it if it exists

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

Summarize


Related articles: