首页 > 解决方案 > 错误:无法解析“:Aware@debug/compileClasspath”的依赖关系:无法解析项目:aars

问题描述

我正在尝试在我的 android 应用程序中使用 pocketsphinx,这给我带来了麻烦。我已经按照此处所述安装了它:Android 上的 PocketSphinx,特别是通过导入 .aar。这是我的代码:

项目 build.gradle 文件:

    buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'com.android.tools.build:gradle:3.2.1'
        //classpath 'com.google.gms:google-services:4.0.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
    defaultConfig {
        applicationId "kutz.connor.Aware"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        DexOptions {
            matchingFallbacks = ['debug', 'release']
        }
    }
}

dependencies {
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.12.0'
    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.google.firebase:firebase-auth:16.0.1'
    implementation 'org.tensorflow:tensorflow-lite:+'
    implementation project(':aars')
}

apply plugin: 'com.google.gms.google-services'

我得到的错误是

ERROR: Unable to resolve dependency for ':Aware@debug/compileClasspath': Could not resolve project :aars.
ERROR: Unable to resolve dependency for ':Aware@debugAndroidTest/compileClasspath': Could not resolve project :aars.
ERROR: Unable to resolve dependency for ':Aware@debugUnitTest/compileClasspath': Could not resolve project :aars.

当我尝试构建项目时。经过研究,我发现这可能与将 Androdi Studio 更新到 3.0 有关。

我尝试过的一些解决方案

添加matchingFallbacks进行调试,在build.gradle函数中发布

为项目创建 settings.gradle

任何帮助都会很棒。我在帖子上也看到了将所有构建类型移动到应用程序 gradle 的帖子,但我不确定如何做到这一点。

编辑

这是项目文件夹中的settings.gradle文件,它只有一行

include ':Aware', ':aars'

标签: androidgradleandroid-gradle-pluginbuild.gradle

解决方案


推荐阅读