Android:无法解决依赖性

时间:2019-10-14 09:03:31

标签: java android dependencies

我对使用Android Studio并不陌生,基本上我的依赖项存在问题,我曾尝试将gradle插件版本升级到3.5.1,并将gradle版本升级到5.4.1,但仍然没有任何反应。我的工作区中基本上有2个项目,一个是nerarosbridgeclient,它是我的库,另一个是机器人实用程序,是我的主要应用程序。

这是我的错误:

Unable to resolve dependency for ':robotutility@debug/compileClasspath': Could not resolve project :nerarosbridgeclient.
Unable to find a matching configuration of project :nerarosbridgeclient:
- None of the consumable configurations have attributes. Could not resolve 
  project :nerarosbridgeclient. Required by: project :robotutility Caused 
 by:org.gradle.internal.component.NoMatchingConfigurationSelectionException: 
 Unable to find a matching configuration of project :nerarosbridgeclient:

-没有任何消耗品配置具有属性。

我的build.gradle(Project):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

  buildscript {
      repositories {
       google()
       jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
      }
   }

 allprojects {
    repositories {
      google()
      jcenter()

    }
 }

task clean(type: Delete) {
  delete rootProject.buildDir

   }

我的build.gradle(模块):

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
    applicationId 'com.nerarobotics.robotutility'
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
     }
 }

  dependencies {
//noinspection DuplicatePlatformClasses
implementation fileTree(include: ['*.jar'], dir: 'libs')

//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation project(path: ':nerarosbridgeclient')
}

还有我的settings.gradle

include ':robotutility', ':nerarosbridgeclient'

我的库build.gradle:

apply plugin: 'com.android.library'

android {
  compileSdkVersion 29
  buildToolsVersion "29.0.2"


defaultConfig {
    minSdkVersion 16
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    consumerProguardFiles 'consumer-rules.pro'
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android- 
 optimize.txt'), 'proguard-rules.pro'
        }
     }

   }

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.neovisionaries:nv-websocket-client:2.9'
}

  buildscript {
    dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
  }
}

0 个答案:

没有答案