Android Studio upgrade from 2.3 to 3.1 considerations

Source: Internet
Author: User
Tags jcenter

Original: 80111111Android Studio upgrade from 2.3 to 3.1 considerations
  • Build.gradle under the project root directory
    Add Google () to the repositories of 1.buildscript and allprojects
    Change the Gradle version to the corresponding version in Classpath in 2.dependencies, such as 3.1.2

    buildscript {    repositories {        google()        jcenter()    }    dependencies {        classpath ‘com.android.tools.build:gradle:3.1.2‘    }}allprojects {    repositories {        google()        jcenter()    }}
  • Build.gradle under the module directory
  • 1. Delete Buildtoolsversion. Android Studio3.0 no need to specify Buildtoolsversion, each version of the Android Gradle plugin has a default version of the build tool, do not delete will only report a warning, but this sentence specifies the build version of the statement will be ignored
    Compile in 2.dependencies is replaced with implementation, Testcompile is replaced with Testimplementation, Androidtestcompile is replaced by 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.properties file under the Gradle/wrapper folder in the project root directory
    Modify the address of the Distributionurl

    distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
  • Note: Most tutorials do not mention this file, if you do not change the address here, compile error

    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).
Note: Specific modifications can be used to create a new blank project as a reference in a newly installed Android studio

Android Studio upgrade from 2.3 to 3.1 considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.