[英]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.