在 IntelliJ IDEA 12 中使用 Facebook Android SDK 时似乎没有获得 Facebook SDK 资源 [英] Seem doesn't get Facebook SDK resource when using Facebook Android SDK in IntelliJ IDEA 12

查看:30
本文介绍了在 IntelliJ IDEA 12 中使用 Facebook Android SDK 时似乎没有获得 Facebook SDK 资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文章将 facebook SDK 添加到 IntelliJ Android 项目?,我选择在项目结构的依赖项"部分添加facebook.jar"文件作为模块.编译过程工作正常.但是,当我尝试使用会话登录"登录 Facebook 时,我收到如下运行时错误消息:

According to the article Add facebook SDK to IntelliJ Android project?, I choose to add the "facebook.jar" file as a Module in the "Dependencies" section in the project structure. The compile process works fine. However, when I trying to using "Session Login" to login in facebook, I got the runtime error message like this:

02-06 20:15:56.648: ERROR/AndroidRuntime(5891): FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.facebook.android.R$layout
    at com.facebook.LoginActivity.onCreate(LoginActivity.java:55)
    at android.app.Activity.performCreate(Activity.java:4524)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2189)
    at android.app.ActivityThread.access$600(ActivityThread.java:139)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:4894)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

看起来 facebook.jar 不包含 facebook sdk 中提供的布局资源本身?不知道我是对还是错.我确实导入了当前项目,并通过 eclipse 构建和运行我的应用程序,它的工作原理非常棒.一切都完美无缺.但是,作为 IntelliJ IDEA 的拥护者,我想寻求是否有人可以为此问题提供解决方案.非常感谢.

It looks like the facebook.jar doesn't contain the layout resource itself provided in facebook sdk? Don't know if I am right or wrong. I do import the current project and build and run my app via eclipse, and it work like a charm. Everything works flawlessly. However, being a IntelliJ IDEA favorer, I would like to seek if anyone could provide solution for this issue. Many thanks.

推荐答案

好的,终于让 facebook android SDK 为我工作了.这是我执行的步骤顺序.

OK, finally got the facebook android SDK worked for me. Here are the order of steps I did.

  1. 打开并进入您当前的 android 项目,然后选择 File |新模块
  2. 选择左侧面板上的Library Module".
  3. 在右侧面板上填写所需信息.这里我只给出了:
    • 模块名称:facebook"
    • Content root:选择下载的facebook android SDK所在的位置,并确保选择名为facebook"的子文件夹


    • 模块文件位置:与内容根目录相同
    • 包名:com.facebook.android(猜猜可以任意分配?)
  1. Open up and be in your current android project then select File | New Module
  2. Choose "Library Module" on the left-side panel.
  3. Fill in the required information on the right-side panel. Here I just given the:
    • Module name: "facebook"
    • Content root: Choose where the downloaded facebook android SDK is, and be sure to select the subfolder named "facebook"


    • Module file location: same as Content root
    • Package name: com.facebook.android (Guess could assign arbitrarily?)

这篇关于在 IntelliJ IDEA 12 中使用 Facebook Android SDK 时似乎没有获得 Facebook SDK 资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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