尽管build.gradle应用了插件com.android.application,但没有Gradle“构建”任务

时间:2016-07-11 13:17:48

标签: android gradle

不知怎的,我没有build任务:

$ ./gradlew tasks --all
:tasks

------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------

Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating] [wrapper]
wrapper - Generates Gradle wrapper files. [incubating]

Help tasks
----------
components - Displays the components produced by root project 'apps-android-commons'. [incubating]
dependencies - Displays all dependencies declared in root project 'apps-android-commons'.
dependencyInsight - Displays the insight into a specific dependency in root project 'apps-android-commons'.
help - Displays a help message.
model - Displays the configuration model of root project 'apps-android-commons'. [incubating]
projects - Displays the sub-projects of root project 'apps-android-commons'.
properties - Displays the properties of root project 'apps-android-commons'.
tasks - Displays the tasks runnable from root project 'apps-android-commons'.

BUILD SUCCESSFUL

尽管我的commons/app/build.gradle适用(如in this other QA所述)相关插件:

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    compile 'in.yuvi:http.fluent:1.3'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.8.4'
    compile 'ch.acra:acra:4.5.0'
    compile 'org.mediawiki:api:1.3'
    compile 'commons-codec:commons-codec:1.10'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'

    //noinspection GradleDependency - old version has required feature
    compile 'com.google.code.gson:gson:1.4'
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    useLibrary  'org.apache.http.legacy'

    defaultConfig {
        applicationId "fr.free.nrw.commons"
        minSdkVersion 11
        targetSdkVersion 23

        ndk {
            moduleName "libtranscode"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    lintOptions {
        disable 'MissingTranslation'
        disable 'ExtraTranslation'
    }
}

问题:为什么会这样,我做错了什么?

这是我的项目结构:

ROOT
 /commons
   /app

...我在ROOT中执行./gradlew

1 个答案:

答案 0 :(得分:0)

如果您的文件夹是:

ROOT
 /commons
   /app

...然后在.gradlew文件夹中执行commons,而不是ROOT

感谢@Opal提示!