Gradle 错误:无法解析::HERE sdk:

Gradle 错误:无法解析::HERE sdk:,gradle,Gradle,我试图创建一个有两种风格的新项目,sdk独立于app。 所以我修改了这些build.gradle文件,如下所示: 对于android lib模块:sdk: apply plugin: 'com.android.library' android { compileSdkVersion 25 buildToolsVersion "26.0.0" defaultConfig { minSdkVersion 19 targetSdkVersio

我试图创建一个有两种风格的新项目,
sdk
独立于
app
。 所以我修改了这些
build.gradle
文件,如下所示:

对于android lib模块:
sdk

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        en
        zh
    }
    publishNonDefault true
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'
    compile(name: 'HERE-sdk', ext: 'aar')
}

repositories {
    flatDir {//HERE SDK
        dirs 'libs'
    }
    mavenCentral()
}
对于android应用程序模块:
app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "cn.hudplay.testgradle"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        en
        zh
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    enCompile project(path:":sdk",configuration:"enRelease")
    zhCompile project(path:":sdk",configuration:"zhRelease")
    //compile(name: 'HERE-sdk', ext: 'aar')//this seems to be workaround if un-blocked
}

repositories {
    flatDir {//HERE SDK
        dirs 'libs'
    }
    mavenCentral()
}
然后它告诉我
无法解析::hereSDK:
,没有其他原因

我尝试将
此处sdk
相关的gradle代码移动到应用程序的
build.gradle
,没有更多错误。但我确实需要在
sdk
模块中使用它

我该怎么办有人能帮我吗

临时使用的解决方法:
在这里编译
app
sdk
的sdk,不再出错。但我还是觉得有些地方不对劲…

您好,这里更新了文档,也许可以帮助您解决这个问题。我也有同样的问题,它是按照以下步骤解决的:


以上面的代码为例(如果有人在寻找一个可行的解决方案),对我有效的方法是:

将“\HERE sdk\libsHERE sdk.aar”文件(从您在此处的帐户加载)复制到您的\App\libs文件夹中,然后:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar','*.aar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'
    //compile(name: 'HERE-sdk', ext: 'aar')
}
注意:更改仅为2行: 注释->//编译(名称:'heresdk',分机:'aar'),并在此处向数组范围添加了->'.aar'扩展->编译文件树(目录:'libs',包括:['.jar','*.aar'])


OBS:我知道这是一个老问题,也许外面的世界已经有人回答了,但我在这里留下了我微薄的贡献。如果有人想雇用我,我正在找一份工作,呵呵

我通过从

打开模块设置

步骤1
,将aar添加到app/libs文件夹中

第2步
,右键单击
应用程序
,然后反向点击
打开模块设置

第3步
,单击左侧的
依赖项
,然后单击
声明的依赖项下的
+

步骤4
,从下拉列表中选择
libs/HERE sdk.aar
,然后单击
OK

我又读了一遍..然后发现了一些可能有用的东西:AAR文件包括
/libs/someLib.jar
,但可能排除
libs/someLib.AAR
我不再从事那个项目了,无论如何,谢谢你的回答。