[英]Importing Facebook SDK 3.0.2 on Android Studio 0.5.4
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. 我一直在使用stackoverflow处理所有问题已经有一段时间了,我认为我必须发布自己的问题的那一天永远不会出现。
So thank you StackOverflow community for all the help so far !!! 因此,谢谢StackOverflow社区到目前为止提供的所有帮助!!!
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: 我一直在浏览Facebook指南 ,以及这些StackOverflow问题,一点都不走运:
" using facebook sdk in android studio " ; “ 在android studio中使用facebook sdk ”;
" Import Facebook SDK on Android Studio 0.5.1 " “ 在Android Studio 0.5.1上导入Facebook SDK ”
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
. 正如我的标题中所述,我正在使用Facebook SDK的最新版本(即
3.0.2
和Android Studio(即0.5.4
。
I really like and hate Android Studio at the same time. 我真的很喜欢同时讨厌Android Studio。 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 ...
它为在Android上进行开发提供了令人难以置信的便利,但是有时对于包含库,模块的方式以及何时出现IDE致命的内部错误,这可能是一场噩梦。
Anyway, to help you help me, here is the content of my project settings.gradle
: 无论如何,为了帮助您,这里是我的项目
settings.gradle
的内容:
include ':main', ':libs:facebook'
build.gradle
: 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');
}
libs/facebook/build.gradle
: 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 : 而且由于答案不明确,所以这是我从SDK下载的存档中提取的facebook文件夹的源代码树:
http://i.stack.imgur.com/pEWa3.png http://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同步时,这是我得到的错误:
Gradle 'Travel3' project refresh failed:
Configuration with name 'default' not found.
Please, do tell me where I am wrong save me from despair ! 拜托,请告诉我我哪里错了,让我免于绝望! ^^
^^
I found out the solution ! 我找到了解决方案!
I took a lot of time to undestand how settings.gradle
works. 我花了很多时间来了解
settings.gradle
工作方式。 I wrongly included the Facebook SDK as a lib ... so this is how it works --> 我错误地将Facebook SDK包含在lib中...所以这就是它的工作原理->
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:
... 是的,只是因为我忘记添加
:main:
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.