简体   繁体   English

为什么我不能在Android Studio上添加Facebook SDK?

[英]Why can't I add Facebook SDK on Android Studio?

I am following the Getting Started, Facebook Android SDK. 我正在关注Facebook Android SDK入门。

But when I am adding the repositories and the dependencies, I get the following error: 但是,当我添加存储库和依赖项时,出现以下错误:

Error: Module version com.facebook.android:facebook-android-sdk:4.1.0 depends on libraries but is not a library itself.

I tried with several versions of the SDK but I can't make it work. 我尝试了多个版本的SDK,但无法正常使用。

This is how my gradle looks: 这是我的gradle的样子:

dependencies{
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
repositories{
mavenCentral()
}

I am using the BuildTools 22.0.1 我正在使用BuildTools 22.0.1

I hope someone can orient my with this issue. 我希望有人可以解决这个问题。

Regards 问候

compile 'com.facebool.android:facebook-android-sdk:4.1.0' Is the facebool correct or is that an error? compile 'com.facebool.android:facebook-android-sdk:4.1.0'是正确的还是错误? If that's an error then that could be your issue. 如果那是一个错误,那可能是您的问题。 Also if you can't get it to compile from a maven source try downloading a jar and putting it in your local library. 另外,如果无法从Maven来源进行编译,请尝试下载一个jar并将其放入本地库中。 Then go into the project structure and go to the module you want to add this library to and click on the dependencies tab and there is a plus icon to add a library from file. 然后进入项目结构,转到要向其中添加该库的模块,然后单击“依赖关系”选项卡,然后出现一个加号图标,以从文件中添加一个库。

In you build.gradle(Project:Your-Project-Name) replace jCentral() with mavenCentral() in both (allproject/repos and buildscript/repos) then sync your gradle. 在您的build.gradle(项目:您的项目名称)替换jCentral()mavenCentral()在两个(allproject /回购和buildscript /回购),那么你的同步的gradle。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM