ParkSangGwon / TedPermission

Easy check permission library for Android Marshmallow
1.74k stars 239 forks source link

Appcomat 테마 오류요. #3

Closed BrokenTeeth closed 7 years ago

BrokenTeeth commented 8 years ago

48:00.252 29302-29302/com.test.permission E/AndroidRuntime: FATAL EXCEPTION: main Process: com.test.permission, PID: 29302 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.permission/com.test.permission.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494) at android.app.ActivityThread.access$900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5527) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:331) at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:300) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:264) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) at com.test.permission.MainActivity.onCreate(MainActivity.java:24) at android.app.Activity.performCreate(Activity.java:6272) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5527)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 

아래 외국인분이 쓰신 오류랑 똑같이 나네요.

테마를 Appcomat 안쓰면 위와 같이 오류가 납니다.

AndroidManifest.xml에서 테마를 노 타이틀바를 주고 테스트 해보시면 됩니다.

<activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">

    </activity>
ParkSangGwon commented 8 years ago

@BrokenTeeth MainActivity테마를 @android:style/Theme.NoTitleBar 로 설정하셨다면 MainActivity가 어떤 Activity를 상속받으셨는지 확인해보세요. Manifest에서는 Appcompat Theme가 아닌데 MainActivity는 AppCompatActivity를 상속받아서 사용하면 위와같은 오류가 발생합니다.

ParkSangGwon commented 7 years ago

No answer close.