0

I am getting following error while adding Facebook sdk Added into android project

UNEXPECTED TOP-LEVEL EXCEPTION: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 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 2

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
amal jofy
  • 73
  • 8

2 Answers2

0

add bellow line in your build.gradle in android function in defaultConfig

multiDexEnabled true

then add this dependencies

compile 'com.android.support:multidex:1.0.1

update your application like bellow

public class MyApplication extends MultiDexApplication {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(base);
    }

then mention it into your manifest

<application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.NoActionBar"></manifest>
Bajirao Shinde
  • 1,356
  • 1
  • 18
  • 26
0

First of all, you need to try reducing the method size before enable multi-dex. I think you should check this answer Error on compile app with Facebook SDK.

Community
  • 1
  • 1
sonngaytho
  • 111
  • 5