'Android project cannot build with gradle after importing a module
I created an android app and I wanted to include the vokaturi module. 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
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.
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
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
Solution 1:[1]
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. 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. Add that line to your app gradle file and then include vokaturi directly as an aar file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
