0

It's been quite some time I have been using stackoverflow for all my issues and I thought the day I'll have to post my own question would never come.

So thank you StackOverflow community for all the help so far !!!

I'm afraid that day has finally come, sot let's get to the point, shall we ?

I've been looking through the Facebook guide, and these StackOverflow questions with no luck at all:

" using facebook sdk in android studio " ;

" Import Facebook SDK on Android Studio 0.5.1 "

As explained in my title, I'm using the most recent versions of both the Facebook SDK which is 3.0.2 and Android Studio which is : 0.5.4.

I really like and hate Android Studio at the same time. It offers incredible confort for developping on Android, but sometimes it can be a real nightmare as to how include libraries, modules and when you get IDE fatal internal errors ...

Anyway, to help you help me, here is the content of my project settings.gradle :

include ':main', ':libs:facebook'

This is the content of my project' build.gradle :

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

     defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:gridlayout-v7:19.0.1'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.darwinsys:hirondelle-date4j:1.5.1@jar'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libs:facebook');
}

Finally this is the content of libs/facebook/build.gradle :

apply plugin: 'android-library'

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

And because answers can't be vague, this is the source tree of the facebook folder I extracted from the SDK downloaded archive :

https://i.stack.imgur.com/pEWa3.png

Well, this is it. When I try to sync with Gradle, this is the error I am getting :

Gradle 'Travel3' project refresh failed:
Configuration with name 'default' not found.

Please, do tell me where I am wrong save me from despair ! ^^

Community
  • 1
  • 1
Mackovich
  • 3,319
  • 6
  • 35
  • 73
  • In a general sense that "Configuration with name 'default' not found" error means that something is usually misconfigured in your settings.gradle file, and it's pointing to a module that doesn't exist or it can't find for some reason -- usually because there's no build.gradle file where it's looking, or there's a serious problems with it that's keeping it from being parsed. In your case, it should be looking in the "main" directory off your project root, and also at "libs/facebook". If that's not enough of a hint to get you going, please post more details about your project's structure. – Scott Barta Apr 15 '14 at 16:26
  • @ScottBarta you pointed me to right direction : it could not find the Facebook SDK build.gradle file because I wrongly included the lib in my **settings.gradle**. You may find details in my answer ! I hope this will help people in my exact situation ! – Mackovich Apr 23 '14 at 14:50

1 Answers1

0

I found out the solution !

I took a lot of time to undestand how settings.gradle works. I wrongly included the Facebook SDK as a lib ... so this is how it works -->

include ':main', ':main:libs:facebook'

As for the the rest is the same as in my original post.

So yeah, just because I forgot to add :main: ...

Mackovich
  • 3,319
  • 6
  • 35
  • 73