Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Android Studio from using Support Library

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.

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.

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.

like image 757
Chris Kdon Avatar asked Nov 19 '13 02:11

Chris Kdon


1 Answers

I'm surprised no one can still give you a straight forward answer. I hope my response will help.

So to stop Android Studio from using support library especially the infamous AppCompat v7, follow these few steps:

1) Gradle Scripts > build.gradle(Module: app)

2) Remove the line that says compile 'com.android.support:appcompat-v7:22.1.1'

3) res/values/styles.xml > change the parent value to: parent="@android:style/Theme.Holo.Light"

4) AndroidManifest.xml > change the application android:theme to: android:theme="@android:style/Theme.Holo.Light"

5) Go into your activities and remove the line that imports the support library. Change it to: import android.app.Activity;

6) Now in the menu bar: Build > ReBuild Project. Correct any errors then keep rebuilding until you get it to work, then run your project to ensure nothing crashes and your references are in order.

For me I got errors stating that I app:ShowAsAction is not supported or so. I had to change it to android:ShowAsAction. Just Make sure that for any error, you read it carefully and follow the suggestions in the little dialogues boxes that pop up beside the error line.

like image 146
Chad Mx Avatar answered Oct 03 '22 09:10

Chad Mx