我正在使用Android Studio关注Facebook SDK for Android.当我运行我的应用程序时,我收到了下面提到的警告.
Gradle: module 'facebook' won't be compiled. Unfortunately you can't have non-Gradle Java module and Android-Gradle module in one project.
Run Code Online (Sandbox Code Playgroud)
我该怎么解决这个问题?
我尝试了@Scott Barta的回答,并收到以下错误消息.
A problem occurred configuring project ':App'.
> Failed to notify project evaluation listener.
> A problem occurred configuring project ':libraries:facebook'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':libraries:facebook:_DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Required by:
MyApplication2.libraries:facebook:unspecified
Run Code Online (Sandbox Code Playgroud) android facebook facebook-android-sdk android-studio android-gradle-plugin
我尝试用facebook SDK测试登录.
所以我加上compile 'com.facebook.android:facebook-android-sdk:4.0.0'.
然后添加FacebookSdk.sdkInitialize(getApplicationContext());
到MainActivity.java
但是当我补充说
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />`
Run Code Online (Sandbox Code Playgroud)
我有以下错误:
Rendering Problems The following classes could not be instantiated:
com.facebook.login.widget.LoginButton (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details java.lang.NoClassDefFoundError: Could not initialize class com.facebook.login.widget.LoginButton
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385) Copy stack to clipboard
Run Code Online (Sandbox Code Playgroud) 我有android studio 1.1.0,我刚创建了一个新项目,我正在尝试导入新的facebook-sdk 4.0.1但是不能这样做,我跟着Facebook入门
但无法让它发挥作用.我的app结构
我的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()
}
}
Run Code Online (Sandbox Code Playgroud)
我的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 …Run Code Online (Sandbox Code Playgroud) 我在导入Facebook SDK时坚持在HelloFacebookSample上获得相同的错误.
错误:(8,0)无法在项目':HelloFacebookSample'上找到属性'ANDROID_BUILD_SDK_VERSION'.
我知道错误与HelloFacebookSample有关,我试图分配'ANDROID_BUILD_SDK_VERSION'= 20(MY SDK VERSION).它仍然会发出同样的错误.
这是一个快照

这个错误正在扼杀我的生命.我怎样才能摆脱这个错误?
有人知道如何在0.8.6版本上导入Facebook SDK吗?事实上,我试图导入Facebook SDK作为模块,但Facebook没有显示为库.
错误:(9)评估项目':facebook'时出现问题.
无法在项目':facebook'上找到属性'ANDROID_BUILD_SDK_VERSION'.
此外,在模块设置中,它不显示为模块
您好,我将facebook sdk添加到我的项目时收到以下错误尝试以下帖子为facebook sdk配置gradle脚本
Error:(111) A problem occurred evaluating project ':facebook'.
> Cannot call getBootClasspath() before setTargetInfo() is called.
Run Code Online (Sandbox Code Playgroud)
这是我的facebook模块gradle脚本
apply plugin: 'com.android.library'
repositories {
mavenCentral()
}
project.group = 'com.facebook.android'
dependencies {
compile 'com.android.support:support-v4:[21,22)'
compile 'com.parse.bolts:bolts-android:1.1.4'
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
minSdkVersion 18
targetSdkVersion 22
}
lintOptions {
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
apply plugin: 'maven'
apply plugin: 'signing'
def isSnapshot = version.endsWith('-SNAPSHOT') …Run Code Online (Sandbox Code Playgroud) 我试图在我的应用程序中使用Facebook登录Android Studio中的Facebook库.
在关注如何在Android Studio 0.6.1上导入该库的9个教程之后,在点击清洁项目之前一切顺利(在上一个教程中),点击它之后我收到此错误:
*C:\Users\Demetria\AndroidStudioProjects\Test\libreries\facebook\src\com\facebook\FacebookA ppLinkResolver.java
Error:(21, 13) error: package bolts does not exist
Error:(37, 49) error: cannot find symbol class AppLinkResolver
Error:(57, 12) error: cannot find symbol class Task
Error:(63, 42) error: cannot find symbol class Continuation
Error:(105, 83) error: cannot find symbol variable Task
Error:(192, 27) error: package AppLink does not exist*
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
提前致谢.