当使用编译'com.google.android.support:wearable:2.0.4'时,出现以下错误,但我没有使用26.0.0 [英] When using compile 'com.google.android.support:wearable:2.0.4' I get the error below, but I am not using 26.0.0

查看:108
本文介绍了当使用编译'com.google.android.support:wearable:2.0.4'时,出现以下错误,但我没有使用26.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用时编译'com.google.android.support:wearable:2.0.4'(最新版本的 com.google.android我的Wear应用程序的build.gradle文件中添加.support:wearable ),出现以下错误,但我没有使用26.0.0。

When using compile 'com.google.android.support:wearable:2.0.4' (the latest version of com.google.android.support:wearable) in my Wear app's build.gradle file, I get the error below, but I am not using 26.0.0.

我该怎么办?即使我添加了编译'com.android.support:wear:26.0.0',它仍然会失败。

What should I do? Even if I add compile 'com.android.support:wear:26.0.0' it still fails.

Error in the project's gradle file: 

Error:(22, 13) Failed to resolve: com.android.support:wear:26.0.0
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:/.../wear/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>


推荐答案

许多磨损元素( BoxInsetLayout WearableRecyclerView SwipeDismissFrameLayout 此处的完整列表)已移至主要的android支持库(详细信息)。您可以继续使用旧的类,但是您可能想要使用最新的类。

Many of the Wear elements (BoxInsetLayout, WearableRecyclerView, SwipeDismissFrameLayout, full list here) have been moved to the main android support library (details). You can continue to use the old classes, but you probably want to use the latest stuff.

您的Wear应用的build.gradle包括编译'com.google.android.support:wearable:2.0.4'使用了 com.android.support:wear:26.0.0 中的某些类。如上面链接中所述,它们已从 com.google.android.support:wearable 移至 com.android.support:wear

The build.gradle for your wear app includes compile 'com.google.android.support:wearable:2.0.4' which uses some classes from com.android.support:wear:26.0.0. As called out in link above, they were moved from com.google.android.support:wearable to com.android.support:wear.

支持库(26)现在位于Google的Maven存储库中(未从SDK Manager通过支持存储库下载),因此您需要添加Google的Maven存储库是您顶级 build.gradle 文件。

The support libraries (26) are now in Google's Maven repository (not downloaded via the support repository from the SDK Manager), so you need to add Google's Maven Repository your top level build.gradle file.

存储库 allprojects 中,添加代码下面。它位于 jcenter()调用下。

In allprojects, within repositories, add the code below. It goes under the jcenter() call.

对于带有Gradle 3.3的Android Gradle插件版本2.3.3( Android Studio 2.3.3),您的代码应如下所示:

For the Android Gradle plugin revision 2.3.3 with Gradle 3.3 (Android Studio 2.3.3), your code should look like this:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

对于Android Studio 3.0.0中带有Gradle 4.1(可能是里程碑版本)的Android Gradle插件修订版3.0.0(现在为Alpha版),您的代码应如下所示:

For the Android Gradle plugin revision 3.0.0 (in alpha right now) with Gradle 4.1 (might be milestone version) in Android Studio 3.0.0, your code should look like this:

allprojects {
    repositories {
        jcenter()
        google()
    }
}

这篇关于当使用编译'com.google.android.support:wearable:2.0.4'时,出现以下错误,但我没有使用26.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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