Skip to main content

Posts

Showing posts from July, 2013

Android Studio - android-4.2.2/dx failed when importing Facebook Android SDK

Problem

Got this error in Android Studio while following Getting Started with the Facebook SDK for Android (Android Studio) tutorial on Facebook.

Gradle: Execution failed for task ':HelloWorldAndroid:dexDebug'.
> Running /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/dx failed. See output




Solution

1. Use latest Android Gradle Plugin

First, in order to use the most recent version of the Android Gradle Plugin, change all occurences of Gradle classpath in build.gradle file.

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:0.4'
  }
}


to

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:0.4.+'
  }
}


2. Install Android Repositories

Make sure the following components of Android SDK are installed:

Android Support RepositoryGoogle Repository


3. Change the reference for Android Support library

The correct way to reference to Android Support Library is shown below. (Instead of referencing android-suppor…