问题描述
关于 IntelliJ 12 + ABS(ActionBarSherlock) 设置的问答有很多.
There are numerous Q&A about IntelliJ 12 + ABS(ActionBarSherlock) settings.
类似于这个问题 但显示不同的错误.
similar case to this question but shows different errors.
整体编译和运行正常,但只有使用 Tab Navigation(SherlockActivity 实现 ActionBar.TabListener
)的 Activity 会出现以下错误和崩溃.请注意,我可以很好地使用一般的 SherlockActivity
显示.
Overall compilation and runnings are OK but only Activity using Tab Navigation(SherlockActivity implements ActionBar.TabListener
) gives following error and crash.Note that I can use general SherlockActivity
shows well.
找不到类 'android.support.v4.app.FragmentActivity',从方法 com.actionbarsherlock.internal.app.ActionBarWrapper$TabWrapper.onTabReselected 引用" 在每个覆盖方法上(onTabUnselected、onTabSelected
、onTabReselected
).
"Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.actionbarsherlock.internal.app.ActionBarWrapper$TabWrapper.onTabReselected" on every overriden methods (onTabUnselected
, onTabSelected
, onTabReselected
).
似乎 android-support-v4 没有成功引用,但很难通过选中/取消选中试错法找到.
It seems like android-support-v4 is not sucessfully referenced but hard to find with check/uncheck trial-and-errors.
我的 IntelliJ 项目设置如下.
My IntelliJ project settings are as below.
1.Library 是 ABS 库文件夹的名称.
2.我的项目设置.
我将 android-support-v4 都设置为 provided.我还能做什么?
I set both android-support-v4 to provided.What can I do more?
有些答案说要将 android-support-v4 移到我自己的项目中,但它在 import android.support.v4.app.FragmentTransaction
上显示参考错误,因为 实现 ActionBar.TabListener
需要它.
Some answers said to remove android-support-v4 to my own project but it shows reference errors on import android.support.v4.app.FragmentTransaction
because implements ActionBar.TabListener
requires it.
推荐答案
这个配置不对,android-support-v4
库的作用域必须设置为Compile 因为它不存在于 Android 上,必须包含在您的应用程序中.
This configuration is not correct, the scope of the android-support-v4
library must be set to Compile as it's not present on Android and must be included in your application.
android-support-v4
的第二个副本必须从应用程序依赖项中删除,它将通过一个库模块提供给您的应用程序,该库模块为android-support-v4
.
Second copy of android-support-v4
must be removed from the application dependencies, it will be available to your application via a library module that has Export option enabled for android-support-v4
.
这篇关于IntelliJ 12 + ActionBarSherlock 设置:找不到类“android.support.v4.app.FragmentActivity"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!