使用支持库停止机器人工作室 [英] Stop Android Studio from using Support Library

查看:159
本文介绍了使用支持库停止机器人工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的机器人工作室Android项目不使用支持库。我的问题是,当我使用的片段是希望支持的片段,并导致应用程序崩溃。

I'm trying to get my Android project in Android Studio to NOT use the Support library. My issue is that when I use fragments it is expecting support fragments and causing the app to crash.

我的民SDK是14,我的目标SDK是19.我的理解是,因为我针对这些版本我不应该需要支持库。纠正我,如果我错了。

My Min SDK is 14 and my Target SDK is 19. My understanding is that because I'm targeting these versions I should not need the support library. Correct me if I'm wrong.

我试图纠正这一错误 java.lang.ClassCastException:com.google.android.gms.maps.MapFragment不能转换为android.support.v4.app.Fragment 。而且我知道我可以只使用 SupportMapFragment ,而不是修复它。但我不希望这样做。我想使用常规MapFragment

I'm trying to correct this error java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment. And I am aware I can fix it by just using SupportMapFragment instead. But I do not want to do this. I want to use the regular MapFragment

所以我的主要问题是我怎么能得到它停止期待支持库碎片,只要使用正规的片段。我也有这个问题,其他的碎片不只是地图上。

So my main question is how can I get it to stop expecting support library fragments and just use regular fragments. I've also had this issue with other fragments not just the map.

推荐答案

如果您解除了支持库的 build.gradle ,而且也没有文件中的文件夹,让你确信删除的进口?

If you've removed the support library from the build.gradle, and there's no file in the libs folder, have you made sure to delete the imports?

从错误信息,它看起来你有以下的进口(否则错误不会知道试图转换为支撑片段)在类的顶部:

From the error message, it looks like you'll have the following import (else the error wouldn't know about trying to cast to a support Fragments) at the top of your class:

进口android.support.v4.app.Fragment;

删除此,它替换为:

进口android.app.Fragment;

与所有支持引用做到这一点。

Do this with all the support references.

这篇关于使用支持库停止机器人工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆