Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle DSL method not found: 'resValue()' error

I have this error while gradle sync. I call the method inside android defaultConfig block. I use com.android.tools.build:gradle:1.3.0 com.neenbedankt.gradle.plugins:android-apt:1.4

build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'config.gradle'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'

    }
}

allprojects {
    repositories {
        jcenter()
    }
}

build.gradle

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}


plugins {
    id "me.tatarka.retrolambda" version "3.2.2"
}


apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'


repositories {
    jcenter()
    mavenCentral()
}

def googlePlayServiceVersion = "8.1.0"
def supportVersion = "23.1.1"
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:'+supportVersion
    compile 'com.android.support:appcompat-v7:'+supportVersion
    compile 'com.android.support:design:'+supportVersion
    compile 'com.android.support:cardview-v7:'+supportVersion
    compile 'com.android.support:recyclerview-v7:'+supportVersion
    compile 'com.android.support:gridlayout-v7:'+supportVersion

    compile 'com.google.android.gms:play-services-base:'+googlePlayServiceVersion
    compile 'com.google.android.gms:play-services-analytics:'+googlePlayServiceVersion
    compile 'com.google.android.gms:play-services-maps:'+googlePlayServiceVersion
    compile 'com.google.android.gms:play-services-location:'+googlePlayServiceVersion

    //ui
    compile 'org.sufficientlysecure:html-textview:1.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'org.solovyev.android.views:linear-layout-manager:0.5@aar'


    //utils
    compile 'me.dm7.barcodescanner:zbar:1.7'
    compile 'org.parceler:parceler-api:1.0.3'
    apt 'org.parceler:parceler:1.0.3'
    compile 'com.anupcowkur:reservoir:2.0'//кеш
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.annimon:stream:1.0.3'


    //networking
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.google.code.gson:gson:2.3.1'

    //dagger
    apt 'com.squareup.dagger:dagger-compiler:1.2.2'
    compile 'com.squareup.dagger:dagger:1.2.2'
}



android {
    String appPackageName = rootProject.ext.basePackageName

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
        disable 'InvalidPackage'
    }

    defaultConfig {

        minSdkVersion 16
        targetSdkVersion 22

        versionCode 6
        versionName "6.0"
        applicationId appPackageName

        resValue 'string' 'appId' appPackageName

//        strings.each { entry ->
//            resValue 'string', entry.key, entry.value
//        }
//
//        colors.each { entry ->
//            resValue 'color', entry.key, entry.value
//        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {

              applicationIdSuffix ".test"
//            minifyEnabled true
//            shrinkResources true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

    }
}

error:

Caused by: org.gradle.api.internal.MissingMethodException: Could not find method resValue() for arguments [string] on ProductFlavor_Decorated{name=main, dimension=null, minSdkVersion=ApiVersionImpl{mApiLevel=16, mCodename='null'}, targetSdkVersion=ApiVersionImpl{mApiLevel=22, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptNdkModeEnabled=null, versionCode=6, versionName=6.0, applicationId=com.my.pocket, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.

at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:68)
    at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)
    at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:172)
    at com.android.build.gradle.internal.dsl.ProductFlavor_Decorated.invokeMethod(Unknown Source)
    at build_cdgdo5tni0sgiyuqwlawpgfo8$_run_closure3_closure6.doCall(***/app/build.gradle:95)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:63)
    at org.gradle.api.Action$execute.call(Unknown Source)
    at com.android.build.gradle.BaseExtension.defaultConfig(BaseExtension.groovy:373)
    at com.android.build.gradle.AppExtension_Decorated.defaultConfig(Unknown Source)
    at build_cdgdo5tni0sgiyuqwlawpgfo8$_run_closure3.doCall(***/app/build.gradle:86)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:63)
    at org.gradle.api.internal.plugins.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:145)
    at org.gradle.api.internal.plugins.ExtensionsStorage.configureExtension(ExtensionsStorage.java:69)
    at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:207)
    at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
    at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
    at build_cdgdo5tni0sgiyuqwlawpgfo8.run(***/app/build.gradle:69)
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
like image 878
punksta Avatar asked Nov 17 '15 07:11

punksta


1 Answers

According to your exception's stack, you should try to separate your arguments with the comma, as I wrote in the comments, because in your case, gradle tries to find a method with only one input argument, but it has no such a method.

defaultConfig {
    ...
    resValue 'string', 'appId', appPackageName //here is what I mean
}
like image 80
Stanislav Avatar answered Oct 17 '22 08:10

Stanislav