我有 android studio 1.1.0,我刚刚创建了一个新项目,我正在尝试导入新的 facebook-sdk 4.0.1 但无法执行此操作,我遵循脸书入门
But can not get it work. My app structure
我的 build.gradle(Project: MyApplication) 文件是:
// 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) 文件是:
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>
Edit我在 build.gradle(Project: MyApplication) 文件的存储库闭包中添加了 mavenCentral() ,但无法处理相同的错误消息。