When using compile 'com.google.android.support:wearable:2.0.4' I get the error below, but I am not using 26.0.0

我怕爱的太早我们不能终老 提交于 2019-12-01 10:44:14

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.

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.

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.

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

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"
        }
    }
}

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()
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!