2

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

Zoe
  • 27,060
  • 21
  • 118
  • 148
Mary
  • 103
  • 2
  • 11

1 Answers1

2

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.

anirudh
  • 424
  • 1
  • 4
  • 12
  • Thank you for response, I did this and I get the error :vokaturi:compileDebugJavaWithJavac – Mary Mar 30 '19 at 11:30
  • Remove this line from your library module build.gradle. implementation(name: 'OpenVokaturi-Android', ext: 'aar') – Ranjan Kumar Mar 30 '19 at 14:14
  • Thank you, the name of the modules differed but it doesn't work if I delete the line from vokaturi module :( If I let it there and in the app module also it works – Mary Mar 31 '19 at 05:48
  • And I have another problem too, in this case it works but it creates to app on the device, not just one. Could you help me with that also? – Mary Mar 31 '19 at 05:58
  • This error appeared when I try to build the app after I delete that line from vokaturi.gradle file org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':vokaturi:compileDebugJavaWithJavac'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110) org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99) ... 34 more – Mary Mar 31 '19 at 11:30