[英]Why i'm getting errors when creating a new eclipse android project?
In Eclipse i'm going to File > New > Other > Android Application Project I give a name then click next next next finish when it's creating the new project i'm getting errors in the console window: 在Eclipse中,我要转到文件>新建>其他> Android应用程序项目,我给它起个名字,然后在创建新项目时单击“下一步”,然后单击“下一步”。
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' 错误:检索项目的父项时出错:找不到与给定名称“ Theme.AppCompat.Light”匹配的资源
6 errors all in styles.xml styles.xml中有6个错误
Also i'm getting errors in the MainActivity.java and i didn't change anything didn'nt even open the MainActivity.java yet. 另外,我在MainActivity.java中遇到错误,并且我没有进行任何更改,甚至没有打开MainActivity.java。
This is the main activity java code i didn't touch or changed anything. 这是我没有触摸或更改任何内容的主要活动Java代码。
package com.example.texttospeech;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
All packages in the android sdk manager already installed. android sdk管理器中的所有软件包已安装。 i'm targeting the project to compile on minimum 7 maximum 18.
我的目标是至少编译7个项目,编译18个项目。
First it was 21 so i created new project targeting and compiling 18. 首先是21岁,所以我创建了新的项目定位和编译项目18。
But same errors. 但是同样的错误。 I didn't have it before.
我以前没有
I remember i deleted a project name: appcompat_v7 maybe i need this ? 我记得我删除了一个项目名称:appcompat_v7也许我需要这个? If so how to get it ?
如果是这样,如何得到它?
Anyway i googled and so far no solution for me. 无论如何,我用谷歌搜索,到目前为止对我来说没有解决方案。
Go to the android sdk folder-> extras -> android -> support -> v7 转到android sdk文件夹-> Extras-> android->支持-> v7
Import the appcompat folder present in v7 folder in eclipse and then add this library to your project. 导入Eclipse中的v7文件夹中存在的appcompat文件夹,然后将此库添加到您的项目中。 This should solve your problem.
这应该可以解决您的问题。
Do the following steps , this may help: 请执行以下步骤,这可能会有所帮助:
if problem still persist , restart eclipse. 如果问题仍然存在,请重新启动eclipse。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.