Skip to main content
8 / 10
gradlew build実行
hai123
  • 379
  • 4
  • 9
  • 22

AndroidStudio(gradle)でビルドエラー (重複クラスでエラー?)

質問です。

AndroidStudio ビルドエラーで実行出来きなくて本当に困っています。
1ヶ月程前は実行出来ていた環境でした。
環境
OSX 10.10.4
AndroidStudio 1.2.2
jdk1.7.0_79.jdk

ソースと参考にしたURLを下に載せました。

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.trustridge.macaroni.app"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 10
        versionName "1.6"
    }

    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 'com.android.support:support-v13:+'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.google.android.gms:play-services:+'

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

    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:+'
}

エラー文

Error:Execution failed for task ':app:dexDebug'.
    > com.android.ide.common.process.ProcessException:
    org.gradle.process.internal.ExecException:
    Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''
    finished with non-zero exit value 2

参考URL http://markfour.blogspot.jp/2015/03/androidsdkerrorexecution-failed-for.html
参考にしたスタックオーバーフローの質問
AndroidStudio(gradle)でビルドエラー Process finished with non-zero exit value 2

試した事

compile fileTree(dir: 'libs', include: ['*.jar'])をコメントアウト→エラー(Warning:(5, 31) 'ActionBarActivity' is deprecated. Deprecated in Javaなど)

//以下をコメントアウトでエラー
compile 'com.android.support:support-v13:+'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:+'
compile "org.jetbrains.kotlin:kotlin-stdlib:+"
compile 'com.parse.bolts:bolts-android:+'
// volley
compile 'com.mcxiaoke.volley:library:+'
// realm
compile 'io.realm:realm-android:+'

Error:(1) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Error:(10, 21) No resource found that matches the given name: attr 'colorAccent'.
Error:(4, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(7, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:Execution failed for task ':app:processDebugResources'.
    > com.android.ide.common.process.ProcessException:
    org.gradle.process.internal.ExecException: Process 'command
    '/Users/makki/Library/Android/sdk/build-tools/22.0.1/aapt'' 
    finished with non-zero exit value 1

追記8/10
・参考にしたサイトその3
http://markfour.blogspot.jp/2015/03/androidsdkerrorexecution-failed-for.html
重複エラーの修正の仕方が書いてありますが、自分場合どのようにすれば良いかわかりません。

追記8/10 (2)

参照先のコマンドラインで直接gradleを実行方法がわかりません。
参考サイトを教えていただけると助かります。こちらで質問しています。

追記8/11
ターミナルからの実行結果

BUILD SUCCESSFULと表示されているのはビルドが成功したからでしょうか? AndroidStudioからはエラーです。

makki-no-MacBook-Pro:gnoccho makki$ ./gradlew -i
Starting Build
Settings evaluated using settings file '/Users/makki/gnoccho/settings.gradle'.
Projects loaded. Root project using build file '/Users/makki/gnoccho/build.gradle'.
Included projects: [root project 'gnoccho', project ':app']
Evaluating root project 'gnoccho' using build file '/Users/makki/gnoccho/build.gradle'.
Evaluating project ':app' using build file '/Users/makki/gnoccho/app/build.gradle'.
Creating configuration compile.
Creating configuration apk.
Creating configuration provided.
Creating configuration wearApp.
Creating configuration androidTestCompile.
Creating configuration androidTestApk.
Creating configuration androidTestProvided.
Creating configuration androidTestWearApp.
Creating configuration testCompile.
Creating configuration testApk.
Creating configuration testProvided.
Creating configuration testWearApp.
Creating configuration debugCompile.
Creating configuration debugApk.
Creating configuration debugProvided.
Creating configuration debugWearApp.
Creating configuration testDebugCompile.
Creating configuration testDebugApk.
Creating configuration testDebugProvided.
Creating configuration testDebugWearApp.
Creating configuration releaseCompile.
Creating configuration releaseApk.
Creating configuration releaseProvided.
Creating configuration releaseWearApp.
Creating configuration testReleaseCompile.
Creating configuration testReleaseApk.
Creating configuration testReleaseProvided.
Creating configuration testReleaseWearApp.
All projects evaluated.
No tasks specified. Using default task 'help'
Selected primary task 'help' from project :
Tasks to be executed: [task ':help']
:help (Thread[main,5,main]) started.
:help
Executing task ':help' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.

Welcome to Gradle 2.2.1.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help
:help (Thread[main,5,main]) completed. Took 0.087 secs.

BUILD SUCCESSFUL

Total time: 10.883 secs
Stopped 0 compiler daemon(s).
makki-no-MacBook-Pro:gnoccho makki$ 

追記 8/11(2)
gradlew buildを実行してみました。

makki-no-MacBook-Pro:gnoccho makki$ ./gradlew build
: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: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 UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
    at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
    at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
    at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 21.375 secs
makki-no-MacBook-Pro:gnoccho makki$ 
hai123
  • 379
  • 4
  • 9
  • 22