搭建环境碰到的问题
我的电脑:MacBook,系统:macOS Catalina(10.15.2),64位,安装了 Android studio 3.5.3
我完全照着官网的步骤搭建环境,还是碰到了一些问题。
- 网络问题
由于我之前安装了 Charles 代理工具,不知道是不是这个工具的问题,反正碰到了不少网络问题,比如AS代理设置问题---How to remove JVM property “https.proxyHost”?,或者run
的时候,报错提示找不到模块。在我把 Charles 里的 Proxy -> macOS Proxy
去掉勾选,然后在 Android studio 里选择 File -> Invalidate Caches / Restart -> invalidate and restart
就好了。
- helloworld程序无法编译
编译配置找不到模块---Android Studio Run/Debug configuration error: Module not specified,如下图。解决其实也正如链接里提到的,在项目根目录下的settings.gradle
里去掉include ':app'
,File -> Sync Project with Gradle files
一下,然后再加回去,再sync一些即可。
image
- 依赖使用阿里云镜像
简单粗暴地设置了一下
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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' }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}