Android studio 3.0 错误,如何解决? [英] Android studio 3.0 error, how can I get rid of it?
问题描述
我现在只是将我的 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'
}
有什么问题吗?
推荐答案
根据新的 gradle 依赖说明
compile
已被弃用,因此库使用 api
并使用最新的稳定库版本为 2.1.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'
<小时>
实现
如果一个实现依赖改变了它的 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 知道该模块希望将该依赖项传递给其他模块,以便它们在运行时和编译时都可以使用时间.这个配置的行为就像编译(现在是
已弃用),您通常应该只在库中使用它
<代码>模块.那是因为,如果一个 api 依赖改变了它的外部API,Gradle 重新编译所有有权访问该依赖项的模块
在编译时
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屋!