简体   繁体   English

Android Studio appcompat库再次丢失

[英]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. 我已经安装了Android SDK工具22.0.1和23.0.3,我希望定位到SDK版本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) 因此,我添加了版本4,然后我得到了相同的错误,两次(彼此之间)

Which is the latest appcompat support library? 哪个是最新的appcompat支持库? 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 我已经安装了Android SDK工具22.0.1和23.0.3

That is irrelevant with respect to using appcompat-v7 . 这与使用appcompat-v7无关。

I want to target SDK version 22 我想定位SDK版本22

Assuming that you mean that you want your targetSdkVersion to be 22, that too is irrelevant with respect to using appcompat-v7 . 假设您要使targetSdkVersion为22,那么对于使用appcompat-v7也是无关紧要的。

Which is the latest appcompat support library? 哪个是最新的appcompat支持库?

Right now, it is 24.1.0. 现在是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. 根据您的具体情况,在开发人员计算机上转到Android SDK安装。 In there, go to extras/android/m2repository/com/android/support/ . 在其中,转到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/ ). 在该目录中,您将看到带有Android支持库所有部分名称的目录(例如, 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 ). 现在,关于您的错误消息的appcompat-v7在于,对于显然已找到的appcompat-v7请求的版本,您在support-v4上遇到了故障(否则,您的错误将是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. 这表明您没有所有Android支持库,可能是由于从SDK Manager安装Android存储库失败。

What if I want to compile with SdkVersion 22? 如果要使用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. 但是,如果您要这样做,则需要选择22系列中的Android支持库工件版本。 On my machine, it looks like 22.2.1 is the latest of those. 在我的机器上,最新的版本是22.2.1。

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 如果您要定位sdk 22添加/更改

    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 虽然最新版本是24.1.0,但是为此您必须再次从sdk-23更新到sdk-24

The latest version is 24.1.0. 最新版本是24.1.0。 You can check it here: https://developer.android.com/topic/libraries/support-library/revisions.html 您可以在此处进行检查: https : //developer.android.com/topic/libraries/support-library/revisions.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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