Android的工作室1.1.0的Facebook SDK登录 [英] Android Studio 1.1.0 Facebook SDK Login

查看:204
本文介绍了Android的工作室1.1.0的Facebook SDK登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试测试与Facebook SDK登录。

所以,我想补充与编译com.facebook.android:facebook-android-sdk:4.0.0

然后添加 FacebookSdk.sdkInitialize(getApplicationContext()); 到MainActivity.java

但是当我添加

 < com.facebook.login.widget.LoginButton
    机器人:ID =@ + ID / login_button
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_gravity =center_horizo​​ntal
    机器人:layout_marginTop =30dp
    机器人:layout_marginBottom =30dp/>`
 

我有这样下面的错误

 渲染问题下面的类不能被实例化:
com.facebook.login.widget.LoginButton(公开课,显示异常)
提示:使用View.isInEditMode()在你的自定义视图跳过code或者在IDE显示显示样本数据
异常详细信息java.lang.NoClassDefFoundError的:无法初始化类com.facebook.login.widget.LoginButton
在java.lang.reflect.Constructor.newInstance(Constructor.java:422)
在android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
在android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
在android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
在android.view.LayoutInflater.inflate(LayoutInflater.java:504)
在android.view.LayoutInflater.inflate(LayoutInflater.java:385)堆栈复制到剪贴板
 

解决方案

导入Facebook的SDK作为一个模块,如果遇到此问题添加到依赖性应该帮助你,顺便说一句:

 错误:(13,0)找不到项目属性ANDROID_BUILD_MIN_SDK_VERSION
 

请检查该讨论:

<一个href="http://stackoverflow.com/questions/24466921/android-studio-0-8-1-how-to-use-facebook-sdk">Import模块问题

祝你好运!

I try to test the login with facebook SDK.

So I add with compile 'com.facebook.android:facebook-android-sdk:4.0.0'.

Then add FacebookSdk.sdkInitialize(getApplicationContext()); to MainActivity.java

But when I add

 <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" />`

I have this following error :

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

解决方案

Importing the Facebook SDK as a module and add it to dependencies should help you, by the way if you encounter this issue:

Error:(13, 0) Could not find property 'ANDROID_BUILD_MIN_SDK_VERSION' on project 

Please check this discussion:

Import module problem

Good luck !

这篇关于Android的工作室1.1.0的Facebook SDK登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆