找不到参数[com.android.volley.tests]

时间:2015-04-28 10:29:31

标签: android android-studio gradle android-gradle

我想从eclipse迁移到工作室。我按照教程,尝试用gradle在studio中构建现有的eclipse应用程序。我在运行此评论时面临以下问题

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

我是工作室和gradle的新手。如何解决这个问题?学习gradle的任何教程?

失败:构建因异常而失败。

  • 其中: 构建文件'/Users/rethinavel/Desktop/WorkSpace/HomeStarProvider/Volley/build.gradle'行:9

  • 出了什么问题: 评估项目':排球'时出现问题。

      

    无法在ProductFlavor_Decorated上找到参数[com.android.volley.tests]的方法testPackageName(){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 = {}}。

这是Build.gradle文件。

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 个答案:

答案 0 :(得分:3)

看起来问题出现在Volley build.gradle文件中。您使用gradle版本1.0.0及更高版本,但自此版本以来方法testPackageName已重命名为testApplicationId。您可以在Android Tools Project Site

上找到所有版本的更改