2018年10月22日月曜日

Gradle sync failed

 Android Studio 3.2 にしたら、「gradleを4.6にしなさい」とおっしゃるので従ったらsyncがうまく行かなくなった。BuildウィンドウにはWarningだけで原因不明。いろいろ調べたがわからないのでgradle 4.4をずっと使っていた。
 Android Studio 3.2.1になった記念にもう一度調べてみるかと思って、ふと、Buildウィンドウの左側のアイコン「Toggle View」[|=/ab](こんなやつ)を押したら表示が切り替わり、

The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.

(ManifestファイルにminSdkVersion バージョンを書かないでね。ボケナス!)

ただこれだけのために何時間使った…自分のバカさ加減に父ちゃん情けなくて涙出てきた。

やっと使えるようになったgradle 4.6は、何かこう、速くなったような気がしないでもない。気のせいかな。

2018年5月4日金曜日

DexArchiveMergerExceptionでコンパイルが通らなくなった

ある日の昼食後、コンパイルしてみるとDexArchiveMergerExceptionが出てコンパイルが通らない。午前中は問題なく、何もしてないのに…こういうのやめてくれ。結構ハマったが何とか解決。

firebase系の各ライブラリのバージョンが独立になったらしい。
https://firebase.google.com/support/release-notes/android

使用しているライブラリを最新にしたらなおった。

2018年4月25日水曜日

DexArchiveBuilderExceptionとか

Android Studioを3.1にしたらコンパイルが通らなくなった。gladle 4.4, Android Plugin for Gradle 3.1で以下のエラー。

Java compiler:
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\XXXXX
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException

Android issues:
Invoke-customs are only supported starting with Android O (--min-api 26)
Message{kind=ERROR, text=Invoke-customs are only supported starting with Android O (--min-api 26), sources=[Unknown source file], tool name=Optional.of(D8)}

Android Plugin for Gradleを3.0.1に戻すとコンパイルが通るのでしばらくごまかしていたのだが、Android Studioを3.1.2にした折にもう一度調べた。

以下をapp/build.gradleに加えることによって解決(gladle 4.4, Android Plugin for Gradle 3.1.2)。意味はよく分かりませんw

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}