无法导入 facebook-sdk 4.0.1 [英] Can not import facebook-sdk 4.0.1
问题描述
我有 android studio 1.1.0,我刚刚创建了一个新项目,我正在尝试导入新的 facebook-sdk 4.0.1,但不能这样做,我跟着 Facebook 入门
I have android studio 1.1.0 and i just created a new project and i'm trying to import new facebook-sdk 4.0.1 but can not do this, I followed Facebook Getting Started
但是不能让它工作.我的应用程序结构
But can not get it work. My app structure
我的 build.gradle(Project: MyApplication) 文件是:
My build.gradle(Project: MyApplication) file is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
//mavenCentral()
}
}
我的 build.gradle(Module: app) 文件是:
My build.gradle(Module: app) file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.hema.myapplication"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
}
最后的错误信息是:
Error:(28, 13) Failed to resolve: com.facebook.android:facebook-android-sdk:4.0.1
<a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
编辑我在 build.gradle(Project: MyApplication) 文件的存储库闭包中添加了 mavenCentral() 但没有使用相同的错误消息.
Edit I added mavenCentral() in the repositories closure in build.gradle(Project: MyApplication) file but not working with same error message.
推荐答案
我解决了这个问题,它在我的 Gradle 设置中 >> Unchecked Offline work
I solved the problem, It was in my Gradle settings >> Unchecked Offline work
这篇关于无法导入 facebook-sdk 4.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!