当<relativelayout>包含<android.support.v4.widget.drawerlayout>时,应用程序退出未处理的异常

时间:2018-05-05 23:52:54

标签: android-studio

每当我在RelativeLayout中有抽屉布局时,我的应用程序就会崩溃。我在网上搜寻类似的东西,但没有看到任何东西。该项目在预览中正确呈现,但是当它在模拟器上运行时,它会崩溃。这是我的XML:

⮟BLACK DOWNWARDS EQUILATERAL ARROWHEAD

我甚至可以在没有编写任何Java代码的情况下重现异常。我得到的例外是:

  

java.lang.NoClassDefFoundError:使用引导类找不到类   装载机;没有可用的堆栈跟踪

     

android.widget.ViewStub

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

While not a real solution, I did find a workaround. I wrapped the DrawerLayout inside a LinearLayout which is inside the RelativeLayout. Here's how my XML ended up looking:

Alamofire.request(finalURL,
    method: method,
    parameters: bodyParams,
    encoding: JSONEncoding.default,
    headers: ["Content-Type": "application/json"])
.responseJSON { response in
    // process response
    }

Hopefully it helps someone else out there that might run into the same problem.