- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试将 facebook 集成到我的应用程序中。我正在使用从 facebook 下载的 facebook 示例应用程序作为引用(还生成了 appId
和 developer.facebook 上的所有过程)。我有点懒,所以我不想浏览 facebook sdk 的所有代码。简单来说,我只是添加我的应用程序中的 com_android_facebook
库项目,并将 facebook 示例应用程序中的所有类复制到我的应用程序中,Example.java 除外
现在我将 MyActivity 类修改为 Example.java 类,这意味着 MyActivity 现在拥有 Example 类的所有代码以及我的主要 Activity。
然后我将应用的布局更改为
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:textSize="22px"
android:textColor="#ff00ff"
android:gravity="center"
>
</TextView>
<com.android.facebook.LoginButton
android:id="@+id/login"
android:src="@drawable/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
/>
<Button android:id="@+id/uploadButton"
android:text="@string/upload"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/requestButton"
android:text="@string/request"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/postButton"
android:text="@string/post"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
<Button android:id="@+id/deletePostButton"
android:text="@string/delete"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:layout_margin="20dp"
/>
</RelativeLayout>
现在当我运行我的应用程序时出现错误
10-14 00:58:37.786: ERROR/AndroidRuntime(3971): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.myapp/com.android.myapp.MyActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class com.android.facebook.LoginButton
10-14 00:58:37.786: ERROR/AndroidRuntime(3971): Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class com.android.facebook.LoginButton
10-14 00:58:37.786: ERROR/AndroidRuntime(3971): Caused by: java.lang.ClassNotFoundException: com.android.facebook.LoginButton in loader dalvik.system.PathClassLoader@44c06850
欢迎任何帮助和建议...
最佳答案
我也遇到了同样的问题。我将 main.xml 更改为:
<com.facebook.android.LoginButton
android:id="@+id/login"
android:src="@drawable/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
/>
到(当前包是 com.facebook.fbtest_simple):
<com.facebook.fbtest_simple.LoginButton
android:id="@+id/login"
android:src="@drawable/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
/>
因为 LoginButton 不是 FB 标准库的一部分。
关于Android ClassNotFound 和 android.view.InflateException :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7759882/
我有一个包含 10 个外部模块的大项目。显然我已经启用了 multidex,因为方法的总数超过了 100k。 现在,如果我在项目中添加“facebook-android”依赖项,当我启动我的应用程序时
ClassNotFound(是的,我知道,有很多关于此异常的帖子;我在这里和其他地方搜索过,但找不到解释) 为什么 Class.forName 会失败? groovy> class Foo { gro
我的 Web 应用程序是使用两个项目构建的,其中一个项目包含 api 和第二个 Web 部件。在 Eclipse 中,我可以在 project-web 中使用 project-api 中的类,但是在部
我正在尝试从 GitHub 运行 Java 项目,但遇到了奇怪的异常。 以下是受影响的代码部分: package de.fau.cs.osr.hddiff.perfsuite; import de.f
我正在尝试将文件中的一些信息读取到某些对象中。 Main 方法只是将信息读入一些字符串变量,然后使用这些字符串来初始化对象。很简单。这些对象使用 BST 存储。 但是,我收到的错误是ClassNotF
当我从命令提示符运行 java 程序时,该程序不会因为 ClassNotFound 错误而无法运行。但我看到的类存在于类路径上的 jar 文件中。当我从 Eclipse 运行时,同样的程序可以工作。不
我有一个小程序和几个 .sh 文件来执行它。我使用 Raspberry-pi 虚拟盒子模拟器来运行它。 (不要问为什么......只是需要它.. :))所以,我的 .sh 文件看起来像: export
我正在努力尝试在 Scala 中设置远程参与者。我正在运行 Scala 2.10.2 和 Akka 2.2.1。 我使用 [为了清楚起见,我缩短了类路径 arg 上的路径] 进行编译: $ scala
我尝试将 RecyclerView 和 CardView 添加到我的项目中 dependencies { compile 'com.android.support:appcompat-v7:21.0.
经过很长时间,对我的代码进行了一些调试和重构,我想重新运行一些测试。我遇到的问题是我总是收到以下错误: "C:\Program Files\Android\Android Studio\jre\bin
我正在学习 Java 并正在阅读这本书:https://www.fca.pt/cgi-bin/fca_main.cgi/?op=2&isbn=978-972-722-791-4 . 在本书中,我有一个
我有麻烦了!我正在尝试通过 IntelliJ IDEA 11 在 JBoss AS 7.1.1.Final 上部署我的应用程序,在部署过程中出现以下异常: 12:23:42,566 ERROR [or
我决定编写 RMI(来自书中),代码也来自书中。我用 rmic 创建了 Stub,并启动了 rmiregistry,但是当我决定编写 java Start Server 时,我遇到了问题,实际上这是我
错误: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.Stuff
所以我想我对 memcached 的工作原理有点困惑。我正在使用不同的框架开发相同的API,所有这些框架都包含memcached(java版本的spymemcached)。当我在第一个框架上设置 me
我正在学习 Java 并正在阅读这本书:https://www.fca.pt/cgi-bin/fca_main.cgi/?op=2&isbn=978-972-722-791-4 . 在本书中,我有一个
我正在 spring mvc 中启动一个新项目,当我尝试运行 hello world 时,它抛出错误: 这是我的dispatcher-servlet.xml 映射:
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
我正在尝试在 hadoop 上启动一个字数统计图 reduce。当我要求 hadoop 完成这项工作时,它返回以下内容: Exception in thread "main" java.lang.Cl
我正在尝试在 HashMap 中创建一个通用值类型,如下所示: val aMap = ArrayBuffer[HashMap[String, Any]]() aMap += HashMap() aMa
我是一名优秀的程序员,十分优秀!