ShadowAlertDialog.getLatestAlertDialog()
ile bir normal android.app.AlertDialog
kullanarak çalışır, ancak bir android.support.v7.app.AlertDialog
destek kütüphanesi kullanırsanız, bu istisna gerçekleşir:V7 destek kütüphanesi kullanılırken Robolectric InflateException AlertDialog
android.view.InflateException: XML file app/build/intermediates/res/qa/debug/layout/abc_alert_dialog_material.xml line #-1 (sorry, not yet implemented): Error inflating class android.support.v7.internal.widget.DialogTitle
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:75)
at android.support.v7.app.AlertController.installContent(AlertController.java:216)
at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:240)
at android.app.Dialog.dispatchOnCreate(Dialog.java:361)
at android.app.Dialog.show(Dialog.java:262)
at org.robolectric.shadows.ShadowDialog.show(ShadowDialog.java:65)
at android.app.Dialog.show(Dialog.java)
<snip>
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -9
at java.lang.String.substring(String.java:1955)
at org.robolectric.res.ResName.qualifyResName(ResName.java:51)
at org.robolectric.res.Attribute.getStyleReference(Attribute.java:147)
at org.robolectric.res.builder.XmlFileBuilder$XmlResourceParserImpl.getResourceId(XmlFileBuilder.java:789)
Bu bilinen bir sorundur, ancak bunun çözümü için en iyi yol nedir?
https://github.com/robolectric/robolectric/issues/1736