Help us understand the problem. What is going on with this article?

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

More than 1 year has 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

izuki_y
ライブラリを使った処理の仕方や手順はQiitaに記載する。 それ以外のアルゴル的な内容はGistに記載する
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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした