If I use new “ V7 Appcompat library ”, do I still need “ V4 Support Library ” for a minimum SDK = 7?

后端 未结 5 1379
深忆病人
深忆病人 2020-12-08 19:37

I am migrating from Action Bar Sherlock to Action Bar compat. I remove ABS and I had support-v4-google maps in it, I got errors. I will add the v4 directly to the project no

相关标签:
5条回答
  • 2020-12-08 20:12

    If you are using Android Studio the default way the v7 support library is included is maven dependencies defined in you build.gradle file.

    dependencies {
        compile 'com.android.support:appcompat-v7:18.0.0'
    }
    

    The appcompat-v7 .aar file does NOT contain the v4 classes. You can see this by looking in your build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar folder. What I have found is that if you create a new project it will also include the .jar file for v4 from the SDK folder.

    0 讨论(0)
  • 2020-12-08 20:12

    In my case, 'android-support-v7-appcompat.jar' alone was not enough when I used public class MainActivity extends AppCompatActivity in Eclipse. I needed to also add android-support-v4.jar (Build Path -> Libraries -> Add JARs). Only then AppCompatActivity was accepted.

    0 讨论(0)
  • 2020-12-08 20:25

    v7 includes the v4 support library so there is no need to have it in there again

    if you look in the libs folder of the v7 support library you will see that the v4 jar is already referenced in the library

    0 讨论(0)
  • 2020-12-08 20:30

    V7 is the new version of the android-support library, just something new things implemented in V7 of V4 support library. So the all method and class of v4 are available inside the v7.

    So if you add v7 library then no need to add v4 library.

    0 讨论(0)
  • 2020-12-08 20:30

    In my case (Eclipse), it depends on which v4 and v7 jar you import in your project.

    My suggestion is to use both the file jar present on this folder: C:\adt-bundle-windows-x86_64-aaaammgg\sdk\extras\android\support\v7\appcompat\libs

    0 讨论(0)
提交回复
热议问题