1

我是使用 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(项目):

// 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'
  }
}
4

0 回答 0