简体   繁体   中英

Android Studio appcompat library missing again

I have installed Android SDK tools 22.0.1 and 23.0.3 I want to target SDK version 22.

After chasing previous posts here, I found that people got this to work

    compile 'com.android.support:appcompat-v7:22.2.1'

However, I am still getting:

Failed to resolve com.android.support:support-v4:22.2.1

So, I add version 4, then I get same error, twice (below each other)

Which is the latest appcompat support library? Where do you find out the latest version?

This is really frustrating...

Thanks

I have installed Android SDK tools 22.0.1 and 23.0.3

That is irrelevant with respect to using appcompat-v7 .

I want to target SDK version 22

Assuming that you mean that you want your targetSdkVersion to be 22, that too is irrelevant with respect to using appcompat-v7 .

Which is the latest appcompat support library?

Right now, it is 24.1.0.

Where do you find out the latest version?

In your specific case, go to the Android SDK installation on your developer machine. In there, go to extras/android/m2repository/com/android/support/ . In there, you will see directories with the names of all the pieces of the Android Support library (eg, appcompat-v7/ ). If you go into any of those, you will see the versions that are available to you.

Now, what is disconcerting about your error messages is that you are getting a failure on support-v4 , for a version requested by an appcompat-v7 that apparently is found (otherwise, your error would be for appcompat-v7 ). This suggests that you do not have all of the Android Support library pieces, perhaps due to a failed installation of the Android Repository from the SDK Manager.

What if I want to compile with SdkVersion 22?

That is not a particularly good idea for new development (vs. maintaining some legacy app). But, if that is what you want, you need to choose Android Support library artifact versions in the 22 series. On my machine, it looks like 22.2.1 is the latest of those.

Change to

compileSdkVersion 23
buildToolsVersion "23.0.3"

and change

compile 'com.android.support:appcompat-v7:22.2.1'

to

compile 'com.android.support:appcompat-v7:23.4.0'

if you want to target sdk 22 add/change

    defaultConfig {
        //
        minSdkVersion 16
        targetSdkVersion 22
        //  
  }

Although latest version is 24.1.0 but for that you have to update again from sdk-23 to sdk-24

The latest version is 24.1.0. You can check it here: https://developer.android.com/topic/libraries/support-library/revisions.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM