0

AndroidStudioでエラーが発生してビルドが出来ません。
原因を調査していますが、助けていただきたいです。

一ヶ月程前も同じような事がありました。

OSX 10.10.5
AndroidStudio 1.3.2
jdk 1.7.0_79

以下にエラーメッセージを貼ります。

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72221Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV132221Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugKotlin
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/data.class: (0, 0): Class 'kotlin/data' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/Unit.class: (0, 0): Class 'kotlin/Unit' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/0.13.1514/9a02485c37501a81fd630978f125395ff24e3dd9/kotlin-stdlib-0.13.1514.jar!/kotlin/properties/Delegates.class: (0, 0): Class 'kotlin/properties/Delegates' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/jvm/functions/Function0.class: (0, 0): Class 'kotlin/jvm/functions/Function0' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/0.13.1514/9a02485c37501a81fd630978f125395ff24e3dd9/kotlin-stdlib-0.13.1514.jar!/kotlin/properties/ReadOnlyProperty.class: (0, 0): Class 'kotlin/properties/ReadOnlyProperty' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/PropertyMetadata.class: (0, 0): Class 'kotlin/PropertyMetadata' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/PropertyMetadataImpl.class: (0, 0): Class 'kotlin/PropertyMetadataImpl' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/0.13.1514/9a02485c37501a81fd630978f125395ff24e3dd9/kotlin-stdlib-0.13.1514.jar!/kotlin/properties/ReadWriteProperty.class: (0, 0): Class 'kotlin/properties/ReadWriteProperty' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/Range.class: (0, 0): Class 'kotlin/Range' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
Error:/Users/makki/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/0.13.1514/917102ebeacadbaa633c17d7141ae466a6ca6947/kotlin-runtime-0.13.1514.jar!/kotlin/internal/InternalPackage.class: (0, 0): Class 'kotlin/internal/InternalPackage' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23
/Users/makki/gnoccho/app/src/main/kotlin/jp/moriturus/yarn/task/Task.kt
Error:(5, 26) Unresolved reference: thread
Error:(12, 5) Unresolved reference: thread
Error:(24, 5) Unresolved reference: thread
Error:(38, 5) Unresolved reference: thread
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/activities/MainActivity.kt
Error:(135, 17) Unresolved reference: println
Error:(143, 29) Unresolved reference: isNotEmpty
Error:(145, 21) Unresolved reference: println
Error:(153, 38) Unresolved reference: isEmpty
Error:(155, 52) Unresolved reference: arrayOf
Error:(232, 54) Unresolved reference: javaClass
Error:(268, 13) Unresolved reference: println
Error:(284, 73) Unresolved reference: toLong
Error:(322, 39) Unresolved reference: javaClass
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/activities/SearchResultActivity.kt
Error:(51, 13) Unresolved reference: println
Error:(55, 13) Unresolved reference: println
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/activities/UserPageActivity.kt
Warning:(27, 35) 'Log' is deprecated. Deprecated in Java
Error:(34, 34) Unresolved reference: arrayListOf
Error:(37, 20) Unresolved reference: arrayListOf
Error:(162, 57) Unresolved reference: javaClass
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/activities/WebViewActivity.kt
Error:(87, 20) Unresolved reference: arrayListOf
Error:(186, 13) Unresolved reference: println
Error:(208, 13) Unresolved reference: println
Error:(219, 43) Unresolved reference: lazy
Error:(221, 53) Unresolved reference: toRegex
Error:(237, 17) Unresolved reference: println
Error:(267, 29) Unresolved reference: println
Error:(268, 29) Unresolved reference: println
Error:(274, 76) Unresolved reference: matches
Error:(275, 29) Unresolved reference: println
Error:(280, 81) Unresolved reference: toInt
Error:(317, 25) Unresolved reference: println
Error:(333, 9) Unresolved reference: println
Error:(362, 9) Unresolved reference: println
Error:(371, 13) Unresolved reference: println
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/advertising/AdvertisingIdentifierManager.kt
Error:(11, 26) Unresolved reference: thread
Error:(70, 56) Unresolved reference: notNull
Error:(78, 9) Unresolved reference: thread
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/api/ApiManager.kt
Error:(71, 30) Unresolved reference: hashMapOf
Error:(76, 13) Unresolved reference: println
Error:(87, 13) Unresolved reference: println
Error:(146, 17) Unresolved reference: println
Error:(207, 17) Unresolved reference: println
Error:(223, 25) Unresolved reference: count
Error:(279, 21) Unresolved reference: println
Error:(348, 17) Unresolved reference: println
Error:(378, 32) Cannot access '<init>': it is 'private' in 'Array'
Error:(378, 32) Type inference failed: Not enough information to infer parameter T in constructor Array<reified T>()
Please specify it explicitly.
Error:(378, 38) Too many arguments for private constructor Array<reified T>() defined in kotlin.Array
Error:(378, 43) Too many arguments for private constructor Array<reified T>() defined in kotlin.Array
Error:(378, 64) Unresolved reference: it
Error:(395, 17) Unresolved reference: println
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/application/analytics/TrackingManager.kt
Error:(28, 28) Unresolved reference: hashMapOf
Error:(30, 12) Unresolved reference: synchronized
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/application/elevationHolder/DefaultElevationHolder.kt
Error:(13, 47) Unresolved reference: notNull
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/category/FeedCategory.kt
Error:(71, 30) For-loop range must have an iterator() method
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/dataSource/DataSource.kt
Error:(16, 55) None of the following functions can be called with the arguments supplied:
public open fun addAll(c: (kotlin.MutableCollection<out T!>..kotlin.Collection<T!>?)): kotlin.Boolean defined in java.util.ArrayList
public open fun addAll(index: kotlin.Int, c: (kotlin.MutableCollection<out T!>..kotlin.Collection<T!>?)): kotlin.Boolean defined in java.util.ArrayList
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/feed/Feed.kt
Error:(110, 30) For-loop range must have an iterator() method
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/feed/user/RealmResultsExtensions.kt
Error:(16, 20) Unresolved reference: arrayListOf
Error:(31, 22) Unresolved reference: count
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/feed/user/User.kt
Error:(39, 24) Unresolved reference: javaClass
Error:(42, 27) Unresolved reference: arrayListOf
Error:(58, 24) Unresolved reference: javaClass
Error:(61, 27) Unresolved reference: arrayListOf
Error:(81, 48) Unresolved reference: javaClass
Error:(88, 47) Unresolved reference: javaClass
Error:(106, 48) Unresolved reference: javaClass
Error:(118, 44) Unresolved reference: javaClass
Error:(132, 48) Unresolved reference: javaClass
Error:(139, 47) Unresolved reference: javaClass
Error:(151, 44) Unresolved reference: javaClass
Error:(163, 21) Unresolved reference: javaClass
Error:(164, 21) Unresolved reference: javaClass
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/data/predicate/Predicate.kt
Error:(23, 16) Unresolved reference: mapOf
Error:(24, 25) Unresolved reference: to
Error:(25, 24) Unresolved reference: to
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/feedList/FeedListAdapter.kt
Error:(70, 21) Unresolved reference: println
Error:(120, 37) Unresolved reference: count
Error:(134, 28) Unresolved reference: count
Error:(136, 31) Unresolved reference: count
Error:(137, 27) Unresolved reference: count
Error:(167, 23) Unresolved reference: count
Error:(290, 32) Unresolved reference: count
Error:(325, 27) Unresolved reference: count
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/feedList/FeedListDataSource.kt
Error:(23, 27) Unresolved reference: arrayListOf
Error:(24, 13) Unresolved reference: arrayListOf
Error:(25, 13) Unresolved reference: arrayListOf
Error:(26, 13) Unresolved reference: arrayListOf
Error:(27, 13) Unresolved reference: arrayListOf
Error:(28, 13) Unresolved reference: arrayListOf
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/FeedListFragment.kt
Error:(31, 49) Unresolved reference: notNull
Error:(32, 67) Unresolved reference: notNull
Error:(34, 57) Unresolved reference: notNull
Error:(35, 60) Unresolved reference: notNull
Error:(235, 45) Unresolved reference: println
Error:(248, 44) Unresolved reference: javaClass
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/FeedListWebFragment.kt
Error:(41, 16) Unresolved reference: arrayListOf
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/KeywordListFragment.kt
Error:(95, 52) Unresolved reference: notNull
Error:(97, 58) Unresolved reference: notNull
Error:(123, 44) Unresolved reference: javaClass
Error:(141, 33) Unresolved reference: toArrayList
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/MainFragment.kt
Error:(32, 54) Unresolved reference: arrayListOf
Error:(73, 45) Unresolved reference: count
Error:(109, 31) Unresolved reference: count
Error:(114, 47) Unresolved reference: notNull
Error:(115, 50) Unresolved reference: notNull
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/SearchFragment.kt
Warning:(5, 31) 'ActionBarActivity' is deprecated. Deprecated in Java
Warning:(20, 41) 'ActionBarActivity' is deprecated. Deprecated in Java
Error:(34, 53) Unresolved reference: notNull
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/fragment/WebFragment.kt
Warning:(12, 23) 'CookieSyncManager' is deprecated. Deprecated in Java
Error:(44, 49) Unresolved reference: notNull
Error:(45, 62) Unresolved reference: notNull
Error:(63, 16) Unresolved reference: arrayListOf
Warning:(161, 13) 'CookieSyncManager' is deprecated. Deprecated in Java
Warning:(173, 13) 'CookieSyncManager' is deprecated. Deprecated in Java
Warning:(173, 45) 'startSync(): Unit' is deprecated. Deprecated in Java
Warning:(184, 13) 'CookieSyncManager' is deprecated. Deprecated in Java
Warning:(184, 45) 'stopSync(): Unit' is deprecated. Deprecated in Java
Error:(216, 9) Unresolved reference: println
Error:(241, 48) Unresolved reference: javaClass
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/view/FeedListCell.kt
Error:(19, 53) Unresolved reference: notNull
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/view/KeywordCell.kt
Error:(14, 53) Unresolved reference: notNull
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/web/EventHandlerManager.kt
Error:(12, 61) Unresolved reference: arrayListOf
Error:(28, 25) Unresolved reference: all
Error:(29, 13) Unresolved reference: it
/Users/makki/gnoccho/app/src/main/kotlin/jp/tttddddgoo/yahoo/app/web/FavorEventHandler.kt
Error:(31, 58) Unresolved reference: toInt
:app:compileDebugKotlin FAILED
Error:Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
Information:BUILD FAILED
Information:Total time: 17.458 secs
Information:127 errors
Information:9 warnings
Information:See complete output in console

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
追記9/25 まだ解決していませんが、「build.gradle」のソースを貼っておきます。

buildscript {
    ext.kotlin_version = '0.12.412'

    repositories {

        jcenter()
        mavenCentral()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"

    }
}

apply plugin: "com.android.application"
apply plugin: 'kotlin-android'

repositories {

    jcenter()
    mavenCentral()

}

android {

    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {

        applicationId "jp.tttddddgoo.yahoo.app"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 10
        versionName "1.6"

        //メソッド数が65535を超える対策2015/08/11
        multiDexEnabled true

    }

    compileOptions {

        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7

    }

    buildTypes {

        release {

            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }

    sourceSets {

        main.java.srcDirs += 'src/main/kotlin'

    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:+"

    compile 'com.android.support:support-v13:+'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:recyclerview-v7:+'

    //メソッド数が65535を超える原因
    compile 'com.google.android.gms:play-services:+'
    //メソッド数が65535を超える対策2015/08/11
    compile 'com.android.support:multidex:1.0.0'


    compile 'com.parse.bolts:bolts-android:+'

    compile fileTree(dir: 'libs', include: ['*.jar'])

    // volley
    compile 'com.mcxiaoke.volley:library:+'

    // realm
    compile 'io.realm:realm-android:+'

    // adjust
    //compile 'com.adjust.sdk:adjust-android:+'

}

2 件の回答 2

6
dependencies {
    ...
    compile "org.jetbrains.kotlin:kotlin-stdlib:+"
    ...
}

ここを、具体的なバージョン番号(Kotlin Stdlib のバージョンの一覧)を指定して、例えば、

compile "org.jetbrains.kotlin:kotlin-stdlib:0.12.1230"

としてみたらどうですか?(最新のものから、一つ一つ遡って試して、問題が出ないものを見つけてみてください)

私自身は Kotlin を使っていないので、Kotlin 自体の具体的な話はわかりませんが、Android Studio と Gradle の使用上の一般的な問題として、+ によるバージョン指定は避けるというのが、tip のようです。

+ 指定すると、自動で最新バージョンに更新するため、簡単に、モジュール間のバージョンに不整合が発生し得るからです。

特に、Kotlin は、1) 開発中の非常にマイナーな言語であること、2) 開発者(JetBrain)が、正式版(1.0)までは、後方互換は顧みないで開発を進めると明言している点など、+ 指定にはかなりリスクが伴うと言えるでしょう。

これで、生じている問題が解消されるかどうかはわかりませんが、気付いた点は以上です。

4

Class '...' was compiled with an incompatible version of Kotlin. Its ABI version is 25, expected ABI version is 23

というエラーメッセージが出ていますが、これの意味するところは、コンパイル時にバージョン23のABI(Wikipedia解説)を使用していたが、今使用しようとしているABIのバージョンがそれより新しい25であるため互換性がなく処理できない、ということです。

まず、問題が発生した場合の対処法ですが、大抵の場合はクリーンビルドを行えば解決するはずです。
Android Studioでは、
Build > Rebuild Project
メニューを選択することになります。

次に、この問題が発生した原因ですが、バージョン指定を'+'としているため最新バージョンが参照される(互換性のない変更も自動で取り込まれてしまう)からです。

これを防ぐためには@hataさん記載の通り明示的にバージョンを指定する必要があります。

あと、これは今回の問題とは直接関係ないと思いますが…
前回の質問文中の記述を見ると、
kotlin-gradle-plugin(及びkotlin-android-extensions)のバージョンは$kotlin_versionと指定しているのに対し、kotlin-stdlibのバージョンは+とされています。
公式サイトの説明を見る限り、これらのバージョンは合わせておくのが妥当だと考えられますので、この点でも、kotlin-stdlibのバージョン指定は$kotlin_versionに変更しておいたほうが良いと思います。
すなわち、

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

としておきましょう、ということですね。

(他にも+指定しているものがありますが、同じような問題が発生する可能性はありますので、明示的バージョン指定に書き換えることも検討してみてください。)

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。