Android Studio小白踩坑记录

写在前面,本人纯纯安卓小白,自己摸索着用Android Studio,遇到了不少问题,在这里记录一下

Android Studio推荐版本问题

我其实不太建议小白直接上来用最新的Android Studio版本,高版本的是kotlin语言编写的。我这里用的是2021版本的,小白用java语言较好。

gradle安装太慢

这个是安装好Android Studio后,新建项目是需要安装。网上有许多的代理思路,尝试无果后,我采用的是换源。

在gradle-wrapper.properties里把原本的gradle源换成下面的

distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.0.2-all.zip

接下来还有许多gradle依赖,依然需要换源。

在build.gradle文件中这样写即可,主要是那几个源。

// Top-level build file where you can add configuration options common ![请添加图片描述](https://img-blog.csdnimg.cn/direct/fa9bade61d1f4e27b13031a4ce458a72.png)

to all sub-projects/modules.

buildscript {

repositories {

maven {url 'https://maven.aliyun.com/repository/google'}

maven {url 'https://maven.aliyun.com/repository/public'}

maven {url 'https://maven.aliyun.com/repository/jcenter'}

google()

mavenCentral()

}

dependencies {

classpath "com.android.tools.build:gradle:7.0.2"

// NOTE: Do not place your application dependencies here; they belong

// in the individual module build.gradle files

}

}

task clean(type: Delete) {