且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

被擦除R.java生成Android的支持-V4错误

更新时间:2022-11-30 11:57:39

我试着在Eclipse中同样的事情,我看到几乎每个文件,有一个失败的导入:

I tried the same thing in Eclipse, and I saw on Most every file, there was a failed import:

import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;

所以,我做了什么来解决这个问题,就是:

So, what I did to fix it, was:

  1. 右键点击您的项目(Support4Demos)在左侧的导航菜单。
  2. 单击属性。
  3. 单击Java构建路径左侧导航窗格中。
  4. 单击添加外部JAR右边按钮。
  5. 导航到:\ Android的SDK \演员\机器人\兼容性\ V4
  6. 选择Android的支持 - v4.jar,然后单击打开,然后单击确定。
  7. 左键点击你的项目(Support4Demos)。
  8. 点击项目的顶部,然后单击清洁,然后单击确定。

可能并不需要的最后两个步骤。但是,当你做的这一切,它可能会解决它。您还需要修复XML文件中的任何错误。

The last two steps might not be needed. But when you do all this, it may fix it. You would also need to fix any error in the XML file.

编辑:
试试这个:


Try this:

  1. 右键点击您的项目,并选择属性。
  2. 选择Android的。
  3. 确保它在Android 3.2或更高的设置。

的Andr​​oid 3.2是在引入的Holo主题的时候。