AndroidStudio+Kotlinのアップデートで詰まった話
環境
- MacBook Pro (Retina, 13-inch, Mid 2014)
- macOS Sierra 10.12.5
2ヶ月ぶりにAndroidStudioを起動したら、Kotlinのバージョンが1.1.2-3から、1.1.3-2に上がっていたので上げてみたところビルドが通らなくなった。 どうやら自分以外にも遭遇している人がいたみたい。 stackoverflow.com
で、回答にこういうことが書いてあった。 gist.github.com
don’t use kapt { generateStubs true } } at all, it will not work with kapt3
書いてあったのでこれ削除した。
ついでにbuildtoolsやらsupportlibraryやらのバージョンも上げてみたら、supportlibraryがないよと怒られた。
いつの間にやらSDK toolsからインストールするんじゃなくてmavenから落っことしてくるスタイルになったみたい。
allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } }
多分これで動いた。(他にもガチャガチャしたのでそれはちゃんと覚えてない)
diff --git build.gradle build.gradle index dfc6deb..be0b64b 100644 --- build.gradle +++ build.gradle @@ -1,12 +1,12 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.1.2-3' + ext.kotlin_version = '1.1.3-2' repositories { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:3.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" @@ -18,6 +18,9 @@ buildscript { allprojects { repositories { jcenter() + maven { + url "https://maven.google.com" + } } } diff --git mobile/build.gradle mobile/build.gradle index 1397a1a..722bab0 100644 --- mobile/build.gradle +++ mobile/build.gradle @@ -2,16 +2,17 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 26 + buildToolsVersion "26.0.0" defaultConfig { applicationId "com.crakac.ofutodon" minSdkVersion 21 - targetSdkVersion 25 + targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -47,32 +48,27 @@ dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" - compile 'com.android.support:appcompat-v7:25.3.1' - compile 'com.android.support:support-v4:25.3.1' - compile 'com.android.support:design:25.3.1' - compile 'com.android.support:support-annotations:25.3.1' - compile 'com.android.support.constraint:constraint-layout:1.0.2' + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + compile 'com.android.support:appcompat-v7:26.0.0-beta2' + compile 'com.android.support:support-v4:26.0.0-beta2' + compile 'com.android.support:design:26.0.0-beta2' + compile 'com.android.support:support-annotations:26.0.0-beta2' - compile 'com.jakewharton:butterknife:8.5.1' + compile 'com.jakewharton:butterknife:8.7.0' - annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' - kapt 'com.jakewharton:butterknife-compiler:8.5.1' + annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0' + kapt 'com.jakewharton:butterknife-compiler:8.7.0' } -kapt { - generateStubs = true -} - repositories { mavenCentral() }