1

When I'm using groovy, there's no problem, but when I'm migrating to kotlin DSL, i have a problem.

here's log from jitpack:

FAILURE: Build failed with an exception.

  • Where: Build file '/home/jitpack/build/commonFunction/build.gradle.kts' line: 1

  • What went wrong: Plugin [id: 'com.android.library'] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
  • Plugin Repositories (plugin dependency must include a version number for this source)

I already tried some way like adding apply(plugin = "com.android.library") in my gradle kts, but that's not work,

here's my gradle file

Gradle Projects:

buildscript {
repositories {
    mavenCentral()
    jcenter()
    google()
}
dependencies {
    classpath(Config.Dependencies.androidPlugin)
    classpath(Config.Dependencies.kotlinPlugin)
}
}
allprojects {
    repositories {
        mavenCentral()
        jcenter()
        google()
        maven { url = uri(Config.Repositories.gradleMaven)  }
    }
}

tasks.register("clean",Delete::class){ delete(rootProject.buildDir) }

Gradle Module:

plugins {
id(Config.Plugins.androidLibrary)
id(Config.Plugins.kotlinAndroid)
id(Config.Plugins.kotlinKapt)
}

android {
    compileSdkVersion(Versions.compileSdk)

    defaultConfig {
        minSdkVersion(Versions.minSdk)
        targetSdkVersion(Versions.targetSdk)
        versionCode = Versions.versionCode
        versionName = Versions.versionName
        testInstrumentationRunner = Config.testRunner
        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    buildFeatures.viewBinding = true
    kotlinOptions.jvmTarget = "1.8"
}

dependencies {
    implementation(Libraries.kotlinStdlib)
    implementation(Libraries.coreKtx)
    implementation(Libraries.appCompat)
    implementation(Libraries.constraintLayout)
    implementation(Libraries.legacySupport)
    implementation(Libraries.fragmentKtx)
    androidTestImplementation(Libraries.testJunit)
    androidTestImplementation(Libraries.espressoCore)
    implementation(Libraries.material)
    testImplementation(Libraries.jUnit)
}
dody.ac
  • 77
  • 1
  • 4

0 Answers0