1

I have worked in android project in android studio, When i start run gradle build and the following errors shown. Anyone help me what is the problem

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3

build.gradle

   apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.stage.lookara"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }
    }

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile files('libs/twitter4j-core-4.0.4.jar')
    compile files('libs/slider.jar')
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.etsy.android.grid:library:1.0.5'
    compile 'com.baoyz.swipemenulistview:library:1.3.0'
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile 'com.github.darsh2:MultipleImageSelect:v0.0.3'
    compile files('libs/pherialize-1.2.1.jar')
    compile 'com.wang.avi:library:2.1.3'
    compile 'com.mikhaellopez:circularprogressbar:1.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 
    'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
    compile 'com.felipecsl:gifimageview:2.1.0'
    }

    repositories {
    jcenter()
    }

    dependencies {
    compile 'org.adw.library:discrete-seekbar:1.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'org.jsoup:jsoup:1.7.3'
    }
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sasi
  • 445
  • 4
  • 19

2 Answers2

1

You are compiling the whole Google play services library:

compile 'com.google.android.gms:play-services:8.3.0'

which can cross the 64K reference limit' during compiling..

See this

if u just use some services from the library you can Selectively compiling APIs into your executable

Like:

 compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'

I would also suggest to use latest version of play services compile 'com.google.android.gms:play-services:10.2.1'

2nd Way

If you really want to use the whole library : Enable Multidex in your application.

in your Gradle:

    android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 25
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

in Application class:

 public class MyApplication extends SomeOtherApplication {
  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
}

Define the application class in manifest:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
0

Try clean first.

If it does not works, add multiDexEnabled to your build.gradle file.

defaultConfig {
    multiDexEnabled true
}

See this: com.android.build.transform.api.TransformException

Community
  • 1
  • 1
Stanley Ko
  • 3,383
  • 3
  • 34
  • 60