简体   繁体   中英

Error:(16, 0) Could not find method android() for arguments on root project 'delta-bartalk' of type org.gradle.api.Project

I am trying to view a layout in a project. The layout shows no images. Everytime I open the project I get an error right now the error being shown is

Error:(16, 0) Could not find method android() for arguments [build_6r57r9htisolgl7blgqlf257v$_run_closure2@22204001] on root project 'delta-bartalk' of type org.gradle.api.Project.

Open file (link to // Top-level build file where you can add configuration options common to all sub-projects/modules.)

I am a beginner with Android studio so I have no idea what to do.

Thanks

_-------------------------------------------------------------------------------

Theses are the files - first Top-level build file Name: delta-bartalk

// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply plugin: 'com.android.application' //[change recommended by comment from Eugen Martynov]


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

android {
}
dependencies {
}

This next code is called bartalk\\build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

In your top level file you have to remove

android { } dependencies { }

And

apply plugin: 'com.android.application'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM