Call requires API level 11 (current min is 8): new android.app.Fragment API版本冲突解决办法
2015-01-24 11:52
567 查看
我当前的应用程序支持的Android最小本号是8,而我需要使用Fragment这个控件,Fragment是API 11之后才有的,所以系统提示我: Call requires API level 11 (current min is 8): new android.app.Fragment 错误,截图如下
下面我们对上面的解决办法分条说明:
@Add @SuppressLint 'NewApi' to ArticleFragment : 选择了这个办法后会在当前类文件中加入一个Import语句:import android.annotation.SuppressLint;并且在类的前面加入一句注解:@SuppressLint("NewApi")。这样做的结果就是——在当前这个类文件中不会再提示'NewApi'这一类的错误。也就是说随便我们用哪个版本的API,都不会在有这一类的提示。
@Add @TargetApi(HONEYCOMB) to 'ArticleFragment' :如果选择了这个办法后,会在当前类文件中加入两个import语句:import android.annotation.TargetApi;
import android.os.Build; 并且在class文件之前加入一句注解:@TargetApi(Build.VERSION_CODES.HONEYCOMB)。这样做的结果就是——告诉编译器当前的这个类使用的API版本是注解括号中的版本,这样编译器在编译程序时,遇到这个类文件就会使用括号中的库来编译程序,而不是使用AndroidManifest.xml中的mininumApi指定的版本。
Explain Issue(NewApi) 这个选项,看文字大家就知道了,是一个说明文档。这个文档说明了NewApi注解的原理,其实就是上面两条解释,我就不再复述了。原文如下:复制不了里面的文字,我截图。
Disable Check In This File Only :这一条的意思是在当前文件中不要在检查错误,所以这一条最好不好选了。
Disable Check In This Project : 在当前项目中不检查,同上。
Disable Check : 同上
Clear AllLink Markers: 如果在当前类文件中有注解信息,点击这一条就会删除注解信息
下面我们对上面的解决办法分条说明:
@Add @SuppressLint 'NewApi' to ArticleFragment : 选择了这个办法后会在当前类文件中加入一个Import语句:import android.annotation.SuppressLint;并且在类的前面加入一句注解:@SuppressLint("NewApi")。这样做的结果就是——在当前这个类文件中不会再提示'NewApi'这一类的错误。也就是说随便我们用哪个版本的API,都不会在有这一类的提示。
@Add @TargetApi(HONEYCOMB) to 'ArticleFragment' :如果选择了这个办法后,会在当前类文件中加入两个import语句:import android.annotation.TargetApi;
import android.os.Build; 并且在class文件之前加入一句注解:@TargetApi(Build.VERSION_CODES.HONEYCOMB)。这样做的结果就是——告诉编译器当前的这个类使用的API版本是注解括号中的版本,这样编译器在编译程序时,遇到这个类文件就会使用括号中的库来编译程序,而不是使用AndroidManifest.xml中的mininumApi指定的版本。
Explain Issue(NewApi) 这个选项,看文字大家就知道了,是一个说明文档。这个文档说明了NewApi注解的原理,其实就是上面两条解释,我就不再复述了。原文如下:复制不了里面的文字,我截图。
Disable Check In This File Only :这一条的意思是在当前文件中不要在检查错误,所以这一条最好不好选了。
Disable Check In This Project : 在当前项目中不检查,同上。
Disable Check : 同上
Clear AllLink Markers: 如果在当前类文件中有注解信息,点击这一条就会删除注解信息
相关文章推荐
- Call requires API level 11 (current min is 8): new android.app.Fragment API版本冲突解决办法
- 解决错误:Call requires API level 11 (current min is 8): new android.app.Fragment
- Call requires API level 11 (current min is 4): android.app.Fragment#<init>
- Call requires API level 11 (current min is 10): android.content.ContentResol 解决方法
- Android之eclipse错误 Call requires API level 3 (current min is 1) 原因分析与解决办法
- eclipse 错误提示API level 11 (current min is 8)android.app.Activity#getActionBar解决办法
- 调用getActionBar()总会报Call requires API level 11 (current min is 8): android.app.Activity#getActionBar
- Type Call requires API level 11 (current min is 8)解决办法
- Call Requires API level 11 (current min is 8) Android.App.Activity#onCreateView
- Call requires API level 23 (current min is 15): android.app.Fragment#getContext,方法报错
- Call requires API level 11 (current min is 7): android.app.ActionBar#setDisplayShowHomeEnabled
- Call requires API level 11 (current min is 8): android.app.Activity#onCreateView 报错问题
- Call requires API level 11 (current min is 8): android.app.Activity#onCreateView
- 【转】调用getActionBar()报Call requires API level 11 (current min is 8): android.app.Activity#getActionBar
- Call requires API level 11 (current min is 8): android.app.A
- Android Call requires API level 11 (current min is 8)的解决方案
- 【Error】Call requires API level 3 (current min is 1)解决办法
- Android Call requires API level 11 (current min is 8)的解决方案
- Android Call requires API level 11 (current min is 8)的解决方案
- Android Call requires API level 11 (current min is 8)的解决方案