Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
19
Help us understand the problem. What is going on with this article?
@izuki_y

AndroidStudio 3.0.1 のビルドエラーについて

More than 3 years have passed since last update.

AndroidStudioが3.0.1に上がった際に過去のプロジェクトをビルドするとエラーが発生した。
その時の対処メモを残す。

エラー

Error:Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

Gradleがバージョンが合わないのが原因。

File -> Project Structure -> Project

から Gradle のバージョンを変更する。

project-gradle.PNG

Gradle と Android Plugin のバージョンの組み合わせはこれを参考にする。
Android Studio 3.0 からは Gradle 3.3 以上を指定する必要がある。

gradle.png

変更後にビルドを行うと以下のエラーが発生する。

Warning:The specified Android SDK Build Tools version (22.0.1) is ignored,
as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '22.0.1'" from your build.
gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

現在の buildToolsVersion が (22.0.1) なので最低でも (26.0.2) に変更しろと言わているのでその通りに変更する。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "screencapture.sample.techbooster.org.screencapture"
        minSdkVersion 22
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

必要があればこちらも参照
http://k-hiura.cocolog-nifty.com/blog/2017/11/androidstudio30.html

19
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
izuki_y
なんかポエム的な記事の方がLGTMが伸びるのなんでだろ~

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
19
Help us understand the problem. What is going on with this article?