美文网首页
2020年mac 如何搭建android 开发环境

2020年mac 如何搭建android 开发环境

作者: 代瑶 | 来源:发表于2020-12-26 17:21 被阅读0次

这篇博客的来源

2020年即将结束, 这已经是我从事第六年移动客户端开发了,前面五年都是以原生语言为主, 最近一年开始研究Flutter, 其实现在跨平台技术已经很成熟了, Flutter 是个很好的跨平台支持技术。它有着接近原生的流畅度,有着符合MD风格的UI组件,能快速上手并制作一个APP。但是并不意味着Android原生开发技能就可以丢弃了, 因为android 本身就是嵌入式系统, 它的应用范围非常广泛, 小到手机, 游戏机,大到汽车上导航板, 医疗设备上都会出现它. 而这些特定地方都会用到原生开发。所以我将捡起丢失了快一年的android!

搭建环境

  1. 下载好android studio
    https://developer.android.google.cn/studio/
  2. 项目中用到的gradle下载并存放到本地
    项目中文件夹gradle下的gradle-wrapper文件.png
    我这里新建的项目用的是gradle6.5, mac电脑, 所以将这个下载好的文件放到/Users//.gradle/wrapper/dists/gradle-6.5-bin/6nifqtx7604sqp1q6g8wikw7p下面 , 然后重启android studio, 如果第三方库下载较慢,在build.gradle文件夹下面配置
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        maven { url 'https://maven.aliyun.com/repository/google' }//阿里镜像
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/google' } //阿里镜像
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

重新async后项目就build好了!
开始你的android之旅吧!!!

相关文章

网友评论

      本文标题:2020年mac 如何搭建android 开发环境

      本文链接:https://www.haomeiwen.com/subject/lougnktx.html