简体   繁体   English

使用Android Studio Facebook SDK

[英]Using Android Studio Facebook SDK

I am following the instructions here , however I am running into problems at step 3 "Import the SDK into an Android Studio Project". 我正在按照此处的说明进行操作,但是在第3步“将SDK导入Android Studio项目”中遇到了问题。 I imported the Module and set to compile as specified however, when I try to modify the settings.gradle I am running into problems. 我导入了模块并设置为按指定编译,但是,当我尝试修改settings.gradle时遇到了问题。 It keeps giving me Gradle 'MyApplicationProject' project refresh failed: You are using an old, unsupported version of Gradle please use 1.6 or higher. 它一直使我的Gradle'MyApplicationProject'项目刷新失败:您使用的是不支持的旧版本Gradle,请使用1.6或更高版本。 I am build the app with version 4.3 compiler while supporting all the way to 4.0(Android). 我正在使用4.3版编译器构建应用程序,同时一直支持4.0(Android)。
This is my settings.gradle 这是我的settings.gradle

include ':MyPeeps'
include ':libraries:facebook', ':MyApplicationProject'

after is wasn't auto populating I added 在不是自动填充之后,我添加了

    dependencies {
compile files('libs/android-support-v4.jar')
compile project(':libraries:facebook')
}

Also put this into the build.gradle 还将其放入build.gradle

     buildscript {
repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.4'
}
}

apply plugin: 'android-library'

dependencies {
    compile files('libs/android-support-v4.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

defaultConfig {
    minSdkVersion 7
    targetSdkVersion 16
}

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

} }

When I go to put in the onCreation command for facebook errors with all the commands that use the facebook api. 当我使用所有使用api api的命令输入onCreation命令以解决facebook错误时。 Does anyone know how I can fix my gradle issues? 有谁知道我该如何解决我的gradle问题?

将'com.android.tools.build:gradle:0.4'更改为'com.android.tools.build:gradle:0.5.+'

I decided to drop android studio and just go back to adt plugin got it work quickly at that point. 我决定放弃android studio,然后回到adt插件使其在这一点上迅速运行。 Thanks for the help. 谢谢您的帮助。

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

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