1.新建project,gradle勾选java kotlin
2.在项目内新建文件夹src,这时候要右击---Mark Directory as Source Root,这样才能在文件夹内新建kotlin class file
3.下载gradle,并配置
注意:当mavenCentral()速度慢时,可以使用jcenter()
一些摘抄:
repositories {
// maven库
def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
def abroad = "http://central.maven.org/maven2/"
// 先从url中下载jar若没有找到,则在artifactUrls中寻找
maven {
url cn
artifactUrls abroad
}
}
allprojects {
repositories {
//jcenter()
//maven{ url 'http://maven.oschina.net/content/groups/public/'}
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}
4.打开gradle 导航页面:View-->Tool windows--->gradle,在里面刷新gradle依赖包