2017-10-13 62 views
1

以前我在使用ShadowAlertDialog.getLatestAlertDialog()来使用Robolectric测试AlertDialog。不过,我已经更新了我的用户界面,现在我正在使用V7支持库。所以,它给了我不兼容的类型错误。Android中的Robolectic与V7支持库问题

Error:(82, 50) error: incompatible types 
required: android.support.v7.app.AlertDialog 
found: android.app.AlertDialog 

有没有解决此问题的解决方案?

回答

0

很简单!更改为:

AlertDialog latestAlert = (AlertDialog) ShadowDialog.getLatestDialog()