欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Androidstudio报错记录

程序员文章站 2024-03-16 13:21:46
...

Android studio3.6.1版本没有Preview!!!
唯一能预览的地方只有

Androidstudio报错记录
还有要注意gradle这个按钮千万不要按(按了之后会变灰)

Androidstudio报错记录

FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ‘:app:lintVitalRelease’.
Could not resolve all task dependencies for configuration ‘:app:lintClassPath’.
Could not resolve com.android.tools.lint:lint-gradle:26.6.1.
Required by:
project :app
No cached version of com.android.tools.lint:lint-gradle:26.6.1 available for offline mode.
No cached version of com.android.tools.lint:lint-gradle:26.6.1 available for offline mode.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 5s

按了的话,build的时候会报错!

原因是gradle处于离线状态(offline),然后就下载不了库,不能进行Build。

https://blog.csdn.net/shenshibaoma/article/details/104588563

如果网络不是很好,经常导致gradle下载慢,超时,或者访问jcenter超时,可以使用下面的阿里云镜像。

Androidstudio报错记录
将上面的内容替换就可以了。

buildscript {
	repositories {
		maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
	}
	dependencies {
		classpath 'com.android.tools.build:gradle:3.6.1'
	}
}

allprojects {
	repositories {
		maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
		maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
	}
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
	repositories {
		// google()
		// jcenter()
		maven { url 'https://maven.aliyun.com/repository/public/' }
		maven { url 'https://maven.aliyun.com/repository/google/'}
		maven { url 'https://maven.aliyun.com/repository/jcenter/'}
		mavenLocal()
		mavenCentral()
	}
	dependencies {
		classpath 'com.android.tools.build:gradle:3.6.1'
		
		// NOTE: Do not place your application dependencies here; they belong
		// in the individual module build.gradle files
	}
}

allprojects {
	repositories {
		// google()
		// jcenter()
		maven { url 'https://maven.aliyun.com/repository/public/' }
		maven { url 'https://maven.aliyun.com/repository/google/'}
		maven { url 'https://maven.aliyun.com/repository/jcenter/'}
		mavenLocal()
		mavenCentral()
	}
}

task clean(type: Delete) {
	delete rootProject.buildDir
}
相关标签: 软件使用