2015年3月29日日曜日

[AndroidSDK]Error:Execution failed for task ':app:dexDebug'.

Android StudioでEclipseで作られた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_75.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2

このログにある
Execution failed for task ':app:dexDebug'.
というエラーの原因は複数ある

EclipseからAndroid Studioのせかえ時のgradle対応でハマったエラーまとめ
http://qiita.com/konifar/items/dbbbfd94ad103239c627

Android Studio: Gradle - build fails — Execution failed for task ':dexDebug'
http://stackoverflow.com/questions/18021901/android-studio-gradle-build-fails-execution-failed-for-task-dexdebug

今回こちらで発生したエラーは
試験用と本番用2つの*.jarのライブラリに同名のクラスがあったため発生した。
重複クラスがあるライブラリのうち1つをgradleファイルから外して解決した

このエラーが発生した時はライブラリを見なおしてみると良い


dependencies {
//    compile files('libs/samplelib_testing.jar')
compile files('libs/samplelib.jar')
}

0 件のコメント:

コメントを投稿