zoukankan      html  css  js  c++  java
  • Android Studio从2.3升级到3.1注意事项

    原文:https://blog.csdn.net/lithiumyoung/article/details/80111111

    Android Studio从2.3升级到3.1注意事项

    • 项目根目录下的build.gradle 
      1.buildscript和allprojects的repositories中添加google() 
      2.dependencies中的classpath中将gradle版本修改为对应版本,如3.1.2

      buildscript {
          repositories {
              google()
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:3.1.2'
          }
      }
      
      allprojects {
          repositories {
              google()
              jcenter()
          }
      }
      
    • module目录下的build.gradle 
    • 1.删除buildToolsVersion。Android Studio3.0之后不需要再指定buildToolsVersion,每个版本的Android Gradle插件都有默认版本的构建工具,不删除只会报警告,但是这句指定构建版本的语句会被忽略 
      2.dependencies中 compile 替换为 implementation ,testCompile 替换为 testImplementation ,androidTestCompile 替换为 androidTestImplementation

      dependencies {
          implementation fileTree(dir: 'libs', include: ['*.jar'])
          implementation 'com.android.support:appcompat-v7:27.1.1'
          testImplementation 'junit:junit:4.12'
          androidTestImplementation 'com.android.support.test:runner:1.0.2'
          androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      }
      
    • 项目根目录下的gradle/wrapper文件夹下的gradle-wrapper.properties文件 
      修改 distributionUrl 的地址

      distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
      
    • 注意:多数教程中都没有提及这个文件,如果不改此处的地址,编译报错

      Gradle DSL method not found: 'google()' Possible causes:  
      The project 'app' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
      

    注意:具体修改内容可用新安装的Android Studio新建一个空白工程作为参照

  • 相关阅读:
    linux MySQL 初始化数据库
    linux 建立 MySQL 账号
    linux MySQL 安装
    Background-Size
    .net文件压缩和解压及中文文件夹名称乱码问题
    C# 浅拷贝与深拷贝区别
    移动端手势库hammerJS 2.0.4官方文档翻译
    期待已久的2012年度最佳jQuery插件揭晓
    Hammer.js
    jQuery Validate验证框架详解
  • 原文地址:https://www.cnblogs.com/tc310/p/9179498.html
Copyright © 2011-2022 走看看