我不知道为什么会有这么多错误。我想我错过了应用程序的主题,但我不知道如何添加它,如果你能告诉我这将是很棒的,谢谢。我以为我已经安装了所有必要的东西。
package com.example.helloworld;
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);
}
}
日志
[2016-08-09 20:13:03 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:03 - HelloWorld]
[2016-08-09 20:13:03 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:03 - HelloWorld]
[2016-08-09 20:13:03 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-08-09 20:13:03 - HelloWorld]
[2016-08-09 20:13:04 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:04 - HelloWorld]
[2016-08-09 20:13:04 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:04 - HelloWorld]
[2016-08-09 20:13:04 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-08-09 20:13:04 - HelloWorld]
[2016-08-09 20:13:26 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:26 - HelloWorld]
[2016-08-09 20:13:26 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-08-09 20:13:26 - HelloWorld]
[2016-08-09 20:13:26 - HelloWorld] H:\Eclipse workspace\HelloWorld\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-08-09 20:13:26 - HelloWorld]
发布于 2016-08-10 13:04:41
AppCompat
是一个库项目。您需要在android项目中引用该库项目。
有关使用resources - https://developer.android.com/tools/support-library/setup.html#add-library添加库的信息,请查看此链接。
不过,我也同意krishnan的评论-切换到Android Studio,省去一些麻烦:)
希望这能有所帮助!
https://stackoverflow.com/questions/38863402
复制相似问题