Android studio 3.0错误,如何解决? [英] Android studio 3.0 error, how can I get rid of it?

查看:208
本文介绍了Android studio 3.0错误,如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在将android studio更新到3.0,但是当我尝试在我的项目上构建apk时,显示以下错误:

I just update my android studio to 3.0 now, but when I try to build apk on my project, it's shows following error:

项目取决于com.google.android.support:wearable:2.0.0,因此它还必须(作为提供的依赖项)依赖于com.google.android.wearable:wearable:2.0.0

我的build.gradle是这样的:

My build.gradle is like that:

dependencies {

    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':lpd')
    compile 'com.google.android.support:wearable:2.0.0-alpha2'
    compile 'com.google.android.gms:play-services-wearable:9.4.0'
    compile files('libs/zxing_2.3.0.jar')
    compile(name: 'hwwearableservice-release', ext: 'aar')
    compile 'com.google.android.gms:play-services-appindexing:9.4.0'
}

有什么问题吗?

推荐答案

按照新的

As per the new gradle dependency instruction the compile has been deprecated so for libraries use api and use the latest stable lib version as 2.1.0

并且由于该版本是稳定版本,所以

and since the version is a stable release so

api 'com.google.android.support:wearable:2.1.0'

或者最好使用

implementation 'com.google.android.support:wearable:2.1.0'


implementation

如果实现依赖项更改其API,则Gradle重新编译 仅此依赖项以及直接依赖于此的模块.最多 应用和测试模块应使用此配置.

if an implementation dependency changes its API, Gradle recompiles only that dependency and the modules that directly depend on it. Most app and test modules should use this configuration.

api

当模块包含api依赖项时,它会让Gradle知道 该模块想要将该依赖关系可传递到其他模块 模块,以便它们在运行时和编译时都可用 时间. This configuration behaves just like compile (which is now deprecated), and you should typically use this only in library modules. That's because, if an api dependency changes its external API, Gradle recompiles all modules that have access to that dependency at compile time

When a module includes an api dependency, it's letting Gradle know that the module wants to transitively export that dependency to other modules, so that it's available to them at both runtime and compile time. This configuration behaves just like compile (which is now deprecated), and you should typically use this only in library modules. That's because, if an api dependency changes its external API, Gradle recompiles all modules that have access to that dependency at compile time

这篇关于Android studio 3.0错误,如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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