Search code examples
androidcontinuous-integrationandroid-gradle-plugingitlab-cigradlew

Android Library & CI


I want to run tests in my android library project from Gitlab CI: My .gitlab-ci.yml file:

before_script:
  - export ANDROID_HOME="/opt/android-sdk"
  - export GRADLE_HOME="/opt/gradle"
  - export PATH="/opt/gradle/bin:$PATH"
  - export PATH=$PATH:/opt/android-sdk/tools
  - export PATH=$PATH:/opt/android-sdk/platform-tools
build:
  script:
    - gradle clean build

I get

Plugin with id 'com.android.library' not found.

What I do wrong? Thanks.


Solution

  • Added the next into my android library build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.2'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }