0

Error:(1, 0) Plugin with id 'com.android.application' not found i googled and searching since 3days but didn't get solution..... stuck totally ** i gradle version :2.5.. **build.gradle(projetc:android)

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath "com.android.tools.build:gradle-experimental:0.2.1"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle(module:app)

    apply plugin: "com.android.model.application"

model {
    android {
        compileSdkVersion = 22
        buildToolsVersion = "22.0.1"

        defaultConfig.with {

            applicationId =  "com.example.altaf.Android"
            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 22
            versionCode = 1
            versionName = "1.0"


            buildConfigFields.with {
                create() {
                    type = "int"
                    name = "VALUE"
                    value = "1"
                }
            }

        }

    }

    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file("proguard-rules.pro"))

        }
    }

    android.productFlavors {
        create("flavor1") {

            applicationId = "com.app"
        }
    }



    // Configures source set directory.

    android.sources {

        main {

            java {

                source {

                    srcDir "src"

                }

            }

        }

    }

}

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:22.2.0"
}

build.gradle(module:opencvlibrary310)

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}
Anand Singh
  • 5,672
  • 2
  • 23
  • 33
aezaz
  • 13
  • 2
  • 8

2 Answers2

1

modify your build.gradle(module:opencvlibrary310) like this:

apply plugin: "com.android.model.application"

model {
    android {
        compileSdkVersion = 22
        buildToolsVersion = "22.0.1"

        defaultConfig.with {

            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 22

        }

    }
}

and I'm using below version of experimental gradle plugin:

classpath 'com.android.tools.build:gradle-experimental:0.4.0'

Update: Remove below lines from app file:

 android.sources {

        main {

            java {

                source {

                    srcDir "src"

                }

            }

        }

    }

I hope it helps.

Anand Singh
  • 5,672
  • 2
  • 23
  • 33
  • failed to find buuild tools revision 22.0.1 ... i installed it but after finish install.. same error occured – aezaz Dec 28 '15 at 10:24
  • same `'com.android.application' not found` error ? @aezaz – Anand Singh Dec 28 '15 at 10:31
  • that error gone but failed to find build tools revision 22.0.1 error shows – aezaz Dec 28 '15 at 10:34
  • Try other build version like 23.0.1 or 19 then clean and rebuild your project. – Anand Singh Dec 28 '15 at 10:40
  • Error:FAILURE: Build failed with an exception. * What went wrong: Task 'generateDebugSources' not found in project ':app'. * Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. – aezaz Dec 28 '15 at 10:45
  • this one error solved but in java file for some opencv imports **import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; import org.opencv.core.Mat; import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.android.Utils; ** error is**cannot resolve symbol** – aezaz Dec 28 '15 at 12:00
  • @aezaz you should accept answer if your above problem solved. For above import errors might be you are missing some library or forgetting to add `opencvlibrary310` library in your `app` project – Anand Singh Dec 28 '15 at 12:02
  • answered accepted ....i have selected lib ... but all others lib working greatly but only few of them isn't working – aezaz Dec 28 '15 at 12:09
  • that lib contains jni code and you have to compile jni code using ndk-build, did you done these things? – Anand Singh Dec 28 '15 at 12:11
  • yes and it is like this **C:\Users\Altaf\AppData\Local\Android\sdk\ndk-bundle** – aezaz Dec 28 '15 at 15:47
0

Change apply plugin: "com.android.application" instead of apply plugin: "com.android.model.application" in build.gradle(module:app)

User6006
  • 597
  • 4
  • 21
  • Rename application package name and try again – User6006 Dec 28 '15 at 09:17
  • changed package name .... from android to andro no affect.... but apply:plugin:com.android.application is same – aezaz Dec 28 '15 at 09:22
  • see this post and try again http://stackoverflow.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found – User6006 Dec 28 '15 at 09:29
  • http://stackoverflow.com/questions/26750404/android-studio-error3-0-plugin-with-id-com-android-application-not-found – User6006 Dec 28 '15 at 09:29