android–Gradle错误:配置声明未声明的依赖项

android–Gradle错误:配置声明未声明的依赖项,第1张

概述我正在制作我的第一个Android服装应用程序,但我无法让AndroidStudio工作.首先我得到了错误"Projectwithpath':wear'couldnotbefoundinproject':mobile'.通过在settings.gradle中添加“include”:wear“解决了这个问题.但随后出现了一个新错误:"Error:Modulevers

我正在制作我的第一个Android服装应用程序,但我无法让AndroID Studio工作.
首先我得到了错误

 "Project with path ':wear' Could not be found in project ':mobile'. 

通过在settings.gradle中添加“include”:wear“解决了这个问题.
但随后出现了一个新错误:

"Error:Module version Test2:mobile:unspecifIEd, configuration 'wearapp' declares a dependency on configuration 'default' which is not declared in the module descriptor for Test2:wear:unspecifIEd" .

我该怎么做才能解决这个错误?

以防万一需要:这是build.gradle:

apply plugin: 'com.androID.application'androID {    compileSdkVersion 23    buildToolsversion "23.0.2"    defaultConfig {        applicationID "com.verbraeken.joost.test2"        minSdkVersion 19        targetSdkVersion 23        versionCode 1        versionname "1.0"    }    buildTypes {        release {            MinifyEnabled false            proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro'        }    }}dependencIEs {    compile filetree(dir: 'libs', include: ['*.jar'])    wearapp project(':wear')    testCompile 'junit:junit:4.12'    compile 'com.androID.support:appcompat-v7:23.1.1'    compile 'com.Google.androID.gms:play-services:8.3.0'    compile 'com.androID.support:design:23.1.1'}

settings.gradle:

include ':mobile'include ':wear'

解决方法:

在AndroID Studio 3.0中,Migrate to the New Plugin的文档说:

dependencIEs {    // This is the old method and no longer works for local    // library modules:    // deBUGCompile project(path: ':foo', configuration: 'deBUG')    // releaseCompile project(path: ':foo', configuration: 'release')    // Instead, simply use the following to take advantage of    // variant-aware dependency resolution. You can learn more about    // the 'implementation' configuration in the section about    // new dependency configurations.    implementation project(':foo')    // You can, however, keep using variant-specific configurations when    // targeting external dependencIEs. The following line adds 'app-magic'    // as a dependency to only the 'deBUG' version of your module.    deBUGImplementation 'com.example.androID:app-magic:12.3'}

所以改变这个

    deBUGCompile project(path: ':foo', configuration: 'deBUG')    releaseCompile project(path: ':foo', configuration: 'release')

对此

    implementation project(':foo')
总结

以上是内存溢出为你收集整理的android – Gradle错误:配置声明未声明的依赖项全部内容,希望文章能够帮你解决android – Gradle错误:配置声明未声明的依赖项所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1102071.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存