Java super.onCreate(savedInstanceState)错误

Java super.onCreate(savedInstanceState)错误,java,android,Java,Android,我为我们的学校项目启动了一个应用程序,当我几乎完成时,我在genymotion模拟器上执行了该程序,并输入了以下代码: package com.example.user.timetableapp; import android.app.Activity; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle;

我为我们的学校项目启动了一个应用程序,当我几乎完成时,我在genymotion模拟器上执行了该程序,并输入了以下代码:

package com.example.user.timetableapp;

    import android.app.Activity;
    import android.content.Intent;
    import android.support.v7.app.ActionBarActivity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.Button;

    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;


    public class MainActivity extends ActionBarActivity {

        Button btn1,btn2,btn3;
        boolean f;
        Intent go;


        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            f=fileExistance("day1.txt");
            String text="";
            String s;

            btn1= (Button) findViewById(R.id.btn1);
            btn2= (Button) findViewById(R.id.btn2);
            btn3= (Button) findViewById(R.id.btn3);
            if(f==false)
            for(int i=1;i<7;i++) {
                try {
                   s="day"+i+".txt";
                    FileOutputStream fos = openFileOutput(s, MODE_PRIVATE);
                    try {
                        fos.write(text.getBytes());
                        fos.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }
        }
        public boolean fileExistance(String fname){
            File file = getBaseContext().getFileStreamPath(fname);
            return file.exists();
        }

        public void go(View v){
        go=new Intent(this,ChooseDay.class);
            startActivity(go);
        }
        public void credits(View v){
            go=new Intent(this,Credits.class);
            startActivity(go);
        }

        public void howto(View v){
            go=new Intent(this,Instructions.class);
            startActivity(go);
        }


        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is      present.
            getMenuInflater().inflate(R.menu.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();

            //noinspection SimplifiableIfStatement
            if (id == R.id.action_settings) {
                return true;
            }

            return super.onOptionsItemSelected(item);
        }

    }
解决办法可能是什么?我是初学者,所以我不明白这些错误是什么意思。 还有,为什么android studio认为我手机的API是1,而它是19?
有什么办法可以解决这个问题吗?

检查你的AndroidManifest.xml
android:theme
你试图使用一个找不到的主题。您可以使用以下行将其添加到Android清单文件中

android:theme=“@style/theme.AppCompat.Light”


“原因:java.lang.IllegalStateException:您需要在此活动中使用Theme.AppCompat主题(或子代)。”在哪个文件中?那么在哪里呢?现在包含时间选择器的xml文件无法渲染。我通过将渲染API降低到19而不是19来解决此问题21@Celeo-相反,这非常明确地回答了OP在评论中附加的后续问题,“在什么文件中”,在哪里?“因此,这是一个让他们能够解决原始问题的答案。嗯,也许你可以回答我对埃里克·格罗夫斯的评论,而不是变得哲学化?
04-08 09:38:02.561    1724-1724/com.example.user.timetableapp I/art﹕ Late-enabling -Xcheck:jni
04-08 09:38:02.871    1724-1724/com.example.user.timetableapp D/AndroidRuntime﹕ Shutting down VM
04-08 09:38:02.874    1724-1724/com.example.user.timetableapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.user.timetableapp, PID: 1724
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.timetableapp/com.example.user.timetableapp.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:151)
            at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138)
            at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123)
            at com.example.user.timetableapp.MainActivity.onCreate(MainActivity.java:27)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)