简体   繁体   English

无法引用主android库

[英]Cannot reference main android Library

I am having some major issues here after updating to android API 20, after creating a new android project on eclipse, I got flagged for tons of bus as you can see below 在更新到android API 20之后,我在这里遇到了一些主要问题,在eclipse上创建了一个新的android项目之后,我被标记为吨公交车,如下所示

Description Resource    Path    Location    Type
ActionBarActivity cannot be resolved to a type  MainActivity.java   /testone/src/com/example/testone    line 8  Java Problem
ActionBarActivity cannot be resolved to a type  MainActivity.java   /testone/src/com/example/testone    line 12 Java Problem
ActionBarActivity cannot be resolved to a type  MainActivity.java   /testone/src/com/example/testone    line 32 Java Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.   styles.xml  /testone/res/values-v14 line 8  Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml  /testone/res/values line 7  Android AAPT Problem
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml  /testone/res/values-v11 line 7  Android AAPT Problem
R cannot be resolved to a variable  MainActivity.java   /testone/src/com/example/testone    line 13 Java Problem
R cannot be resolved to a variable  MainActivity.java   /testone/src/com/example/testone    line 19 Java Problem
R cannot be resolved to a variable  MainActivity.java   /testone/src/com/example/testone    line 29 Java Problem
The import android.support.v7 cannot be resolved    MainActivity.java   /testone/src/com/example/testone    line 3  Java Problem
The method getMenuInflater() is undefined for the type MainActivity MainActivity.java   /testone/src/com/example/testone    line 19 Java Problem
The method onCreate(Bundle) of type MainActivity must override or implement a supertype method  MainActivity.java   /testone/src/com/example/testone    line 11 Java Problem
The method onCreateOptionsMenu(Menu) of type MainActivity must override or implement a supertype method MainActivity.java   /testone/src/com/example/testone    line 17 Java Problem
The method onOptionsItemSelected(MenuItem) of type MainActivity must override or implement a supertype method   MainActivity.java   /testone/src/com/example/testone    line 24 Java Problem

I already tried several methods that I found online but nothing seems to work. 我已经尝试了几种在网上找到的方法,但似乎没有任何效果。 I tried: Fix project properties option doesnt do anything, when I try to add the library manually, I find that the appcompat_v7 is missing and when I try to add another library, the add library drop down menu is grayed out and cannot be selected. 我尝试过:修复项目属性选项不执行任何操作,当我尝试手动添加库时,我发现缺少appcompat_v7,并且当我尝试添加另一个库时,添加库下拉菜单显示为灰色,无法选择。 So I'm not really sure what to do here and i'm at a complete loss. 所以我不太确定在这里做什么,我完全不知所措。

I was also stuck with the same issue few day ago, 几天前我也遇到了同样的问题,

I resolved the same issue by updating sdk to latest version 23.0.4. 我通过将sdk更新到最新版本23.0.4解决了相同的问题。 and extras: Android support Repository to rev. 其他:Android支持版本库。 6 Android support Library to rev. 6 Android支持库进行修订。 20 20

first of all open up your Android sdk Manager from eclipse and download all latest sdk updates and extra downloads. 首先,从eclipse打开您的Android sdk管理器,然后下载所有最新的sdk更新和额外下载。

And then after downloading all updates , you have need to use a fresh Eclips editor because your existing eclipse will not let you successfully update from Android sdk tool 20 to 21.0.4 Then just use a fresh eclips editor and set up updated android sdk path in the fresh eclips (the same one you have used in your last eclipse editor , you can find it at Window>> Prefrences >> Android). 然后,在下载所有更新后,您需要使用新的Eclips编辑器,因为现有的Eclipse无法让您成功地从Android sdk工具20更新到21.0.4,然后使用新的eclips编辑器并在其中设置更新的android sdk路径新鲜的食(您在上一个食编辑器中使用过的食,您可以在Window >> Prefrences >> Android中找到它)。

Hopefully this will solve your problem. 希望这可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM