Noticed crash using Crashlytics
Closed this issue · 4 comments
Fatal Exception: 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:359)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)
at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:83)
at android.support.v7.app.AlertController.installContent(AlertController.java:225)
at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:257)
at android.app.Dialog.dispatchOnCreate(Dialog.java:733)
at android.app.Dialog.show(Dialog.java:469)
at com.github.javiersantos.appupdater.AppUpdater$1.onSuccess(AppUpdater.java:347)
at com.github.javiersantos.appupdater.UtilsAsync$LatestAppVersion.onPostExecute(UtilsAsync.java:97)
at com.github.javiersantos.appupdater.UtilsAsync$LatestAppVersion.onPostExecute(UtilsAsync.java:15)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.access$500(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7407)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Could you please paste the code you use from the library? The builder I mean.
Nothing, just:
AppUpdater appUpdater = new AppUpdater(this);
appUpdater.start();
Inside my application object passing global context
AppUpdater uses an AlertDialog
from the AppCompat
library to display the dialog, which requires the AppCompat
theme to be applied.
I think the problem here is that your activity is not using an AppCompat
theme. Make sure the android:theme
line from the AndroidManifest
refers to an AppCompat
theme.
Have a look to the sample project too, which is an implementation of the library using AppCompat
.
Hope it helps.
A word of caution here. The most common cause of that statement actually isn't a style problem at all. You've most likely passed in the application context to AppUpdater instead of the activity context. If you do this, you will the above log statement even if your styles are all fine and your activity is extending AppCompatActivity. Don't waste 2 hours like I just did.
Eugens answer here led me to this
https://stackoverflow.com/questions/30180052/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity-chan