Reputation: 368
I didn't added any libraries / jars in my project( in libs ) only this dependencies.
My build.gradle file.
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.android.example23"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'com.android.support:design:23.1.1'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.parse:parse-android:1.11.0'
compile 'com.naver.android.helloyako:imagecropview:1.0.3'
compile 'com.squareup.okhttp:okhttp:2.6.0'
}
Once I am adding this " compile 'com.squareup.okhttp:okhttp:2.6.0' " into my project I am getting this
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2
Error is coming while I run my project....
If I remove this " compile 'com.squareup.okhttp:okhttp:2.6.0' " dependency my program is working fine.
Sometimes if I added Facebook dependency also the same error is coming...
Upvotes: 3
Views: 1717
Reputation: 2812
you can use below code also with IntelliJ Amiya answer. In some case this code work for me
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
}
you can do by make an Application class
public class MyApplication extends MultiDexApplication { .. }
or
override
attachBaseContext method and call MultiDex.install().
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Otherwise (if your application does not have custom Application implementation), declare MultiDexApplication as application implementation in your AndroidManifest.xml.
<application
android:name="android.support.multidex.MultiDexApplication"
.. >
..
</application>
Upvotes: 3
Reputation: 75788
At first you can use compile 'com.squareup.okhttp:okhttp:2.5.0'
instead of yours . You can read my answer DexIndexOverflowException
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.okhttp:okhttp:2.5.0'
}
http://developer.android.com/intl/es/tools/building/multidex.html
Upvotes: 3
Reputation: 1806
add
useLibrary 'org.apache.http.legacy'
in your gradle before the compileSdkversion...
Upvotes: 0