4
votes

I wanted to migrate from eclipse to studio. I followed a tutorial and tried to build the existing eclipse app in studio with gradle. I am facing the following issue while running this comment

 Rethinavels-Mac-mini:HomeStarProvider rethinavel$ ./gradlew clean

I am new to studio and gradle. How to fix this thing up? Any tutorials to learn gradle?

FAILURE: Build failed with an exception.

  • Where: Build file '/Users/rethinavel/Desktop/WorkSpace/HomeStarProvider/Volley/build.gradle' line: 9

  • What went wrong: A problem occurred evaluating project ':Volley'.

    Could not find method testPackageName() for arguments [com.android.volley.tests] on ProductFlavor_Decorated{name=main, minSdkVersion=null, targetSdkVersion=null, renderscriptTargetApi=null,

    renderscriptSupportModeEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=null, testApplicationId=null, testInstrumentationRunner=null, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.

Here is the Build.gradle file.

buildscript {
                    repositories {
                        mavenCentral()
                    }
                    dependencies {
                        classpath 'com.android.tools.build:gradle:1.0.+'
                    }
                }

    apply plugin: 'android'
    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
        compile project(':SliderLibrary')
        compile project(':Volley')
        compile project(':Google Play Services Library')
        compile project(':viewanimationLibrary')
    }

    android {
        compileSdkVersion 19
        buildToolsVersion "20.0.0"

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }


        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                aidl.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                res.srcDirs = ['res']
                assets.srcDirs = ['assets']
            }

            // Move the tests to tests/java, tests/res, etc...
            androidTestCompile.setRoot('tests')

            // Move the build types to build-types/<type>
            // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
            // This moves them out of them default location under src/<type>/... which would
            // conflict with src/ being used by the main source set.
            // Adding new build types or product flavors should be accompanied
            // by a similar customization.
            debug.setRoot('build-types/debug')
            release.setRoot('build-types/release')
        }

        productFlavors {
            flavor1 {
                applicationId "com.homestar.provider"
            }
        }

    }
1

1 Answers

3
votes

Looks like problem is in Volley build.gradle file. You use gradle version 1.0.0 and higher, but method testPackageName renamed to testApplicationId since this version. All changes in versions you can find on Android Tools Project Site