简体   繁体   English

为什么在创建新的Eclipse Android项目时出现错误?

[英]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: 请执行以下步骤,这可能会有所帮助:

  1. import android.app.Activity; 导入android.app.Activity; paste this line in imports 将此行粘贴到导入中
  2. Replace ActionBarActivity with Activity. 将ActionBarActivity替换为Activity。
  3. Remove all methods except onCreate for now. 暂时删除除onCreate之外的所有方法。
  4. Clean and Rebuilt project. 清理和重建项目。

if problem still persist , restart eclipse. 如果问题仍然存在,请重新启动eclipse。

暂无
暂无

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

相关问题 为什么在创建新的 android 项目时会出现渲染错误? - Why am I getting rendering errors when creating a new android project? 创建新的Android项目时Eclipse崩溃 - Eclipse crashes when creating a new android project 为什么在我创建新项目时android studio中出现这个错误? - why this errors in android studio occurred when i create new project? Eclipse在创建Android项目时出现很多错误 - Eclipse has bunch of errors when creating an Android project 当我在Eclipse中创建Web应用程序项目以使用Provisioning API创建用户帐户时,出现以下错误 - When i am creating Web Application project in Eclipse for creating user account using Provisioning API i am getting the following errors 在eclipse android real设备上运行我的程序时,我在LogCat中遇到许多错误,这些错误以及如何解决? - When running my program on eclipse android real device i'm getting many errors in the LogCat what all this errors and how to fix them? 在Eclipse中创建新的Android测试项目时出错 - Error when creating a new Android test project in Eclipse 在eclipse上打开android项目时出现一些错误 - when open an android project on eclipse i got some errors 我尝试在 Ubuntu 20.04 的 eclipse 中创建一个新项目,但它给了我这个错误 构建期间发生错误 - I tried creating a new project in eclipse in Ubuntu 20.04 but it gives me this error Errors occurred during the build 导出为Android项目后出现Eclipse错误 - Eclipse Errors after I Export as Android Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM