1
resposta

Fatal Exception

Pessoal estou tentando fazer o flappy bird no android studio, porem ocorreu algum erro depois que eu tentei deixar o app sem o actionBar,segue abaixo o codigo.

E/AndroidRuntime: FATAL EXCEPTION: main Process: br.com.jumper.br.jumper, PID: 2954 java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.jumper.br.jumper/br.com.jumper.br.jumper.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) 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:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354) at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) at br.com.jumper.br.jumper.MainActivity.onCreate(MainActivity.java:11) at android.app.Activity.performCreate(Activity.java:6010) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) 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:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Meu arquivo androidManifest.xml: <?xml version="1.0" encoding="utf-8"?>

1 resposta

Olá Lucas,

Dá uma olhada no arquivo res/values/styles.xml. Lá você deve ter algo parecido com o abaixo para retirar a action bar:

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">

Se já estiver tudo certo, verifica se nas suas classes de Activity elas estão estendendo da classe AppCompatActivity. Essa classe é necessária para que o tema selecionado no styles.xml faça sentido.