Android Studio Gradle build script not working

4.4k Views Asked by At

This is the build script used by an Android client built on top of the MifosX platform for the mifos user community.

/*
 * This project is licensed under the open source MPL V2.
 * See https://github.com/openMF/android-client/blob/master/LICENSE.md
 */

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.github.triplet.gradle:play-publisher:1.1.4'
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url 'http://dl.bintray.com/amulyakhare/maven' }
}
....
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply from: '../config/quality/quality.gradle'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.github.triplet.play'

....
dependencies {
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile fileTree(include: ['*.jar'], dir: 'src/main/libs')
    //DBFlow dependencies
    apt "com.github.Raizlabs.DBFlow:dbflow-processor:$rootProject.raizLabsDBFlow" compile "com.github.Raizlabs.DBFlow:dbflow-core:$rootProject.raizLabsDBFlow" compile "com.github.Raizlabs.DBFlow:dbflow:$rootProject.raizLabsDBFlow"
    // App's Support dependencies, including test
    compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" compile "com.android.support:support-v4:$rootProject.supportLibraryVersion" compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" compile "com.android.support:design:$rootProject.supportLibraryVersion" compile "com.google.android.gms:play-services-places:$rootProject.playServicesVersion" compile "com.google.android.gms:play-services-location:$rootProject.playServicesVersion" compile "com.google.android.gms:play-services-maps:$rootProject.playServicesVersion" compile "com.google.maps.android:android-maps-utils:$rootProject.mapUtilsServices" compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion"
    //Dagger dependencies
    apt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" compile "com.google.dagger:dagger:$rootProject.daggerVersion" provided 'javax.annotation:jsr250-api:1.0'
    //Required by Dagger2
    //Butter Knife
    compile "com.jakewharton:butterknife:$rootProject.butterKnifeVersion" apt "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
    //Square dependencies
    compile("com.squareup.retrofit2:retrofit:$rootProject.retrofitVersionLatest") {
        // exclude Retrofit’s OkHttp peer-dependency module and define your own module import
        exclude module: 'okhttp'
    }
    compile "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersionLatest" compile "com.squareup.retrofit2:converter-scalars:$rootProject.retrofitVersionLatest" compile "com.squareup.retrofit2:adapter-rxjava:$rootProject.retrofitVersionLatest" compile "com.squareup.okhttp3:okhttp:$rootProject.okHttp3Version" compile "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttp3Version" compile "com.jakewharton.fliptables:fliptables:$rootProject.flipTableVersion" compile 'javax.annotation:jsr250-api:1.0@jar'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.4'
    compile 'com.facebook.stetho:stetho:1.3.1'
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
    compile 'com.joanzapata.iconify:android-iconify-material:2.1.1'
    // (v2.0.0)
    compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
    }
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    // Android Testing Support Library's runner and rules
    androidTestCompile "com.android.support.test:runner:$rootProject.runnerVersion" androidTestCompile "com.android.support.test:rules:$rootProject.rulesVersion"
    // Espresso UI Testing dependencies.
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion") {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
        exclude group: 'com.android.support', module: 'design'
    }
    androidTestCompile "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion" testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
}

However whenever I build this script I get this error:

Error:(135, 1) A problem occurred evaluating project ':mifosng-android'.
> Could not find method compile() for arguments [com.github.Raizlabs.DBFlow:dbflow-core:3.1.1] on DefaultExternalModuleDependency{group='com.github.Raizlabs.DBFlow', name='dbflow-processor', version='3.1.1', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.

I am using Android Studio 2.1.1.

Please help me.

2

There are 2 best solutions below

1
Dishonered On

Add this line above dependancies

def raizLabsDBFlow= "4.0.1"

0
Yogendra On

In new android project build script and move into setting grdle.

setting.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

enter image description here

Have a good day!