Failed to apply plugin [id 'com.android.library']

16,673

Well I just solved the issue by replacing

apply plugin: 'com.android.library'

with its deprecated version

apply plugin: 'android-library'

That seems to work for now, but I don't think this is the optimal solution, so I'm open to better ones.

Share:
16,673
Dr3w Br1ck13
Author by

Dr3w Br1ck13

Updated on June 11, 2022

Comments

  • Dr3w Br1ck13
    Dr3w Br1ck13 about 2 years

    I try to compile a Android Project which uses another library called HoloGraphLibrary. But when I want to compile the following error occurs:

    Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "9e19705c8c53c2712ca27200bfa349e4757e2264"

    Error:(1, 1) A problem occurred evaluating project ':HoloGraphLibrary'.

    Failed to apply plugin [id 'com.android.library'] Could not create plugin of type 'LibraryPlugin'.

    The source of that error is:

    apply plugin: 'com.android.library'
    
    android {
        compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
        buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
    
        sourceSets {
            main {
                java.srcDirs = ['src']
                res.srcDirs = ['res']
                manifest.srcFile 'AndroidManifest.xml'
            }
        }
    }
    

    which is the build.gradle of the library. The build.gradle of the app looks as follows:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion '19.1.0'
        defaultConfig {
            applicationId "XXXXXXXXXXX"
            minSdkVersion 14
            targetSdkVersion 21
            versionCode 2
            versionName '1.0.1'
        }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            res.srcDirs = ['src/main/res', 'src/main/res/tut', 'src/main/res/tutorial']
            resources.srcDirs = ['src/main/resources', 'src/main/resources/te']
        }
    }
    }
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile project(":HoloGraphLibrary")
    }
    

    I just don't see how i can fix this. Any hints?

    Thank you

    --------------- EDIT ----------------

    This is the top level gradle file.

    // 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:2.1.0-beta1'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    

    Unfortunately, the suggestion of G.K. did not work!

    I have even tried to set the ANDROID_DAILY_OVERRIDE variable to what it has said to, but again the same error.

    • G. Kalender
      G. Kalender about 8 years
      This will probably help you,
    • Gabriele Mariotti
      Gabriele Mariotti about 8 years
      Post the root-level file
  • Ishita Sinha
    Ishita Sinha about 6 years
    android-library is deprecated :(