简体   繁体   English

导入模块后,Android 项目无法使用 gradle 构建

[英]Android project cannot build with gradle after importing a module

I created an android app and I wanted to include the vokaturi module.我创建了一个 android 应用程序,我想包含 vokaturi 模块。 I changed the vokaturi.gradle file with "com.android.library" and I included ":vokaturi" module in the settings.gradle file and in the main app module I added implementation project(':vokaturi') When I try to syncronised main app module I get the error我用"com.android.library"更改了vokaturi.gradle文件,并在settings.gradle文件和主应用程序模块中包含了":vokaturi"模块,我添加了implementation project(':vokaturi')当我尝试同步时主应用程序模块我收到错误

Could not find :OpenVokaturi-Android:.
Required by:
    project :app > project :vokaturi
Search in build.gradle files  

This is how my main app.gradle file looks like.这就是我的主要 app.gradle 文件的样子。

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.afinity"
        minSdkVersion 21
        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 {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout: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 project(':vokaturi')
    }

And this is how the vokaturi.gradle file looks like这就是 vokaturi.gradle 文件的样子

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    defaultConfig {

        minSdkVersion 21
        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'
        }
    }
}
repositories {
    flatDir {
        dirs 'libs/aars'
    }
}
dependencies {
    implementation(name: 'OpenVokaturi-Android', ext: 'aar')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

I do not know what I do wrong...I am new at android, thank you all for any help我不知道我做错了什么......我是android的新手,谢谢大家的帮助

The default name of the file is probably - OpenVokaturi-3-0-android.aar and not OpenVokaturi-Android which is why you're getting that error.该文件的默认名称可能是 - OpenVokaturi-3-0-android.aar 而不是 OpenVokaturi-Android,这就是您收到该错误的原因。 Also this -还有这个——

implementation(name: 'OpenVokaturi-3-0-android.aar', ext: 'aar')

should not be in your vokaturi module but rather in your app.gradle file.不应在您的 vokaturi 模块中,而应在您的 app.gradle 文件中。 Add that line to your app gradle file and then include vokaturi directly as an aar file.将该行添加到您的应用程序 gradle 文件中,然后将 vokaturi 直接包含为 aar 文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将gradle项目作为模块导入后,android studio无法解析Symbol R - android studio cannot resolve Symbol R after importing a gradle project as module Gradle 将模块导入 Android 项目后构建失败 - Gradle Build fails after importing modules into Android project 安卓工作室。 build,gradle - 导入项目后找不到属性 - android studio. build,gradle - Could not find property, after importing project Android Studio:从 G​​ithub 导入项目并使用 gradle 文件重建/清理/同步后“无法解析符号 R” - Android Studio: "cannot resolve symbol R" after importing Project from Github and rebuilding/cleaning/syncing with gradle files 找不到Gradle DSL方法:将模块导入项目后'compileSdkVersion()' - Gradle DSL method not found: 'compileSdkVersion()' after importing a module into the project 从github导入Android Studio项目时发生Gradle构建错误 - Gradle build error when importing project of android studio from github 将项目导入Android Studio时,如何使自动Gradle构建静音? - How to silence automatic gradle build while importing a project to Android Studio? 构建build.gradle文件后,无法从Eclipse将Android项目导入Android Studio - Cannot import an Android project from Eclipse to Android Studio after building a build.gradle file 更新后无法构建 android 项目,错误:此构建中使用了已弃用的 Gradle 功能,使其与 Gradle 5.0 不兼容 - Cannot build android project after updating, error: Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 导入gradle项目,android错误 - Importing gradle project, android error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM