よく寝てよく遊びよくサボる

趣味のAndroidアプリ開発の話や、その他諸々の情報について掲載していきます。自らの備忘の面が強いので情報の正確性は保証できませんが、誰かの役に立てば是幸い。(リンクはご自由に!)

Android Studio 3.1.1および3.1.2への更新

しばらくAndroid Studioの更新をサボっていたら、4月はバージョン3.1.1と3.1.2の二つ更新があったようで、一遍に更新する羽目になりました。

 

今回の更新では、次のGradle Sync Issues(エラー)が出ました。

・Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

・Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

・Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

・Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

・Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

 

説明の リンクがあるので辿ってみると、build.gradleで使用しているcompile等について新しいコンフィグレーションへ変更しなさいということだったので、早速一通り更新

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:design:27.1.1'

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

 

あれ?'androidTestApi''testCompile''testApi'は使ってないけど、まぁいいか、これで解決。

…と思っていたら、まぁそんなに上手くはいきません。

 

・Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

 このエラーだけ消えない。

全部のcompileを置き換えたはずなのに…。

 

と思って検索したら、こちらに書いてありました。

stackoverflow.com

 

要するにcom.google.gms:google-servicesのバージョン更新が必要だったようです。

classpath 'com.google.gms:google-services:3.1.0'

classpath 'com.google.gms:google-services:3.2.0'

 

これにて無事解決しました。