19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-12-21

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
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?