Trying to add module to project. Plugin with id 'kotlin-android' not found

Vasko Vasilev

I am trying to add a epub reader library to a project I have already created. The library I am trying to add to my project as a moduel is the Folio Reader Library (https://github.com/FolioReader/FolioReader-Android). I have downloaded this library on my computer and have tried adding it through File -> New -> Import Module. However, during the process I receive this error:

ERROR: Plugin with id 'kotlin-android' not found.

This file is located in the build.gradle file of the Folio Reader Library.

build.gradle file:

apply plugin: 'com.android.library'
apply from: '../config/quality/quality.gradle'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

ext {
bintrayRepo = 'maven'
bintrayName = 'folioreader'

publishedGroupId = 'com.folioreader'
libraryName = 'FolioReader'
artifact = 'folioreader'

libraryDescription = 'An epub reader for Android'

siteUrl = 'https://github.com/FolioReader/FolioReader-Android'
gitUrl = 'https://github.com/FolioReader/FolioReader-Android.git'

libraryVersion = versions.folioreaderSdk

developerId = 'mobisystech'
developerName = 'Folio Reader'
developerEmail = '[email protected]'

licenseName = 'FreeBSD License'
licenseUrl = 'https://en.wikipedia.org/wiki/FreeBSD_Documentation_License#License'
allLicenses = ["FreeBSD"]
}

android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion versions.androidCompileSdk

defaultConfig {
    minSdkVersion versions.androidMinSdk
    targetSdkVersion versions.androidTargetSdk
    versionCode versions.projectVersionCode
    versionName versions.projectVersionName
    vectorDrawables.useSupportLibrary = true
}

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src/main/java']
        res.srcDirs = ['res']
    }
    test {
        java.srcDirs = ['src/test/java']
    }
}

packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/services/javax.annotation.processing.Processor'
}

lintOptions {
    abortOnError false
    lintConfig file("lint.xml")
}

checkstyle {
    ignoreFailures = true
}
}

apply from: '../folioreader/bintray/installv1.gradle'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation "androidx.appcompat:appcompat:$versions.appcompat"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
implementation "androidx.recyclerview:recyclerview:$versions.recyclerview"
implementation "com.google.android.material:material:$versions.material"
testImplementation 'junit:junit:4.12'

implementation 'org.slf4j:slf4j-android:1.7.25'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'

//Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin"

implementation 'org.greenrobot:eventbus:3.1.1'

implementation "com.fasterxml.jackson.core:jackson-core:$versions.jackson"
implementation "com.fasterxml.jackson.core:jackson-annotations:$versions.jackson"
implementation "com.fasterxml.jackson.core:jackson-databind:$versions.jackson"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$versions.jackson"
implementation "com.google.code.gson:gson:$versions.gson"

implementation "com.squareup.retrofit2:retrofit:$versions.retrofit"
implementation "com.squareup.retrofit2:converter-jackson:$versions.retrofit"
implementation "com.squareup.retrofit2:converter-gson:$versions.retrofit"

// R2 modules
api("com.github.codetoart:r2-shared-kotlin:$versions.r2SharedKotlin") {
    changing = true
}
api("com.github.codetoart:r2-streamer-kotlin:$versions.r2StreamerKotlin") {
    exclude group: "org.slf4j", module: "slf4j-api"
    changing = true
}

// Only ReflectionUtils in Spring framework is used
implementation 'org.springframework:spring-core:4.3.19.RELEASE'

// Lifecycle
implementation "androidx.lifecycle:lifecycle- 
extensions:$versions.lifecycle"
}
apply from: '../folioreader/bintray/bintrayv1.gradle'

I have tried some of the answers posted here but they do not work. How can I solve this problem?

EDIT:

I added

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.4-3"

in my dependencies and have received the following error:

ERROR: Could not get unknown property 'versions' for object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension.

it is occuring on line 20 on the same build.gradle file:

libraryVersion = versions.folioreaderSdk

updating to newer version does not work:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
Vinay W

Looking at the library structure on Github, it seems you need to do the following

  • Go to YOUR project level build.gradle file (not the module level build.gradle)
  • Look at the repositories, dependencies in the Library's project level build.gradle file and copy them over to YOUR project level build.gradle file (including the kotlin-gradle-plugin dependency)

Note: in case you haven't worked with External variables syntax before, you can find those variables for this library in the root directory of the github repository.

In this case, writing

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"` 

will resolve to the following (you can directly write this in your project)

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11" 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to configure SonarQube (with jacoco) on multi module android project (kotlin + java)?

Android Studio: Plugin with id 'android-library' not found

Plugin with id 'crashlytics' not found issue with Android studio latest plugin

MockContentResolver is not found in an Android Test project with separate module

Plugin with id `kotlin` not found

Android studio : Plugin with id 'com.android.application' not found

How to manually add Gradle module to Android project?

Why Kotlin plugin adds kotlin-stdlib-jre7 (not kotlin-stdlib) reference for Android project

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

How to add Kotlin PSI source files to IDEA Plugin project configuration

Trying to add a new module to a project. Fails to read script

Gradle DSL method not found: 'kapt()' and Plugin with id 'kotlin-kapt' not found

CacheOpenException when trying to migrate Android Gradle project from Groovy to Kotlin

Getting "Failed to apply plugin [id 'kotlin-android']" when trying Flutter hello world code

How to add Android Kotlin files to a Cordova Plugin project

Android Studio Error: (8, 0) Plugin with id 'android' not found

Uncaught module <plugin ID> not found for cordova 3.6.3

Error:(9, 0) Plugin with id 'android' not found

Importing project and migrating to Gradle: Error:(1, 0) Plugin with id 'com.android.application' not found

Cordova plugin with id 'android' not found

Trying to add Android Studio Project to github

Plugin with id 'gwt' not found

Plugin with id 'sonar' not found?

Android project shows the `android` module not found

A problem occurred evaluating root project 'audioplayers'. Failed to apply plugin [id 'kotlin-android'] in Flutter Project

Plugin with id 'maven' not found

The id I am trying to add to use navigation in Kotlin gives an error

Plugin [id: 'androidx.navigation.safeargs.kotlin'] was not found

how to solve this kotlin plugin problem in android project?

TOP Ranking

HotTag

Archive