如何解决Android Studio中面临的渲染问题

时间:2019-09-06 16:39:22

标签: java android noclassdeffounderror

我在android studio 3.5中遇到渲染问题,并且在设计视图中看不到任何东西 这是图像(https://imagebin.ca/v/4u6FFIcRScdm)的链接

我已经尝试过从构建选项中清除代码,并用Base.Theme.AppCompat.Light.DarkActionBar替换了styles.xml Theme.AppCompat.Light.DarkActionBar

这是错误

{{1}}

1 个答案:

答案 0 :(得分:0)

当我尝试在Emulator上激活BarcodeScanner时遇到了这个问题,这是不可能的,因为Emulator没有它,并且抛出了NoClassDefFoundError。在模拟器上运行应用程序时,我使用try ... catch ...解决了此问题。一旦将其安装在真实设备上,它就不会抛出此错误。您可以像这样使用它,

 try {

     //Code that is throwing this error

 } catch (NoClassDefFoundError ignore) {

     //Do nothing

 }

如果您遇到类似问题,请尝试此操作。应该可以。