Exception occurred applying plugin request[id:'org.jetbrains.kotlin.jvm', version:'1.3.40-eap-40'] - kotlin

An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.jvm', version: '1.3.40-eap-40']
> Failed to apply plugin [id 'org.jetbrains.kotlin.jvm']
> Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
This error occurs in my build.gradle.kts file
Did you happen to see this error in a Kotlin Cocoapods project built from the samples provided on Kotlin/Native GitHub?

This error occurs because in the build.gradle.kts, there are conflicting plugin imports. Like seen below:
You can't have kotlin 'Jim' plugin and 'multi-platform plugin' together, so remove the kotlin("jvm") version "1.3.31" and build your gradle project.
Also, when you remove this will be accompanied by few more errors in the dependencies section. So comment out everything from dependencies and the two compile tasks below as well and build it. It should work!

Related

Gradle fails after kotlin serialization plugin update to 1.7.10

My build.gradle.kts starts as follows:
...
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
...
kotlin("jvm") //target version is java 11
kotlin("plugin.serialization") version "1.6.21"
}
When I try to update the kotlin serialization plugin to the more recent 1.7.10 version, I get the following compilation error:
A problem occurred configuring project ':my-little-project'.
> Failed to notify project evaluation listener.
> org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin not a subtype
> org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin not a subtype
How do I fix this? Thanks!
Stack trace (too large to post completely, for more just ask):
Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':my-little-project'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:68)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$400(LifecycleProjectEvaluator.java:51)
...
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:89)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:346)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:249)
...
Thanks #aSemy for listing what turned out to be the issue. Our microservice architecture meant there was another, overarching, build.gradle.kts file which contained this line that also needed updating:
kotlin("jvm") version "1.6.10" apply false

module can't find package com.google.gson.stream

a project i'm working with has a dependency on kotlin.jvm.internal.Intrinsics. so i added kotlin-gradle-plugin-1.5.0.jar. now i'm getting an error that it can't find gson.streams. any idea what this is all about?
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: E:\jars\kotlin-gradle-plugin-1.5.0.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Package com.google.gson.stream not found in module
i already have gson-2.8,6.jar in my classpath.
The Jar kotlin-gradle-plugin version 1.5.0 seems to have runtime dependency with com.google.code.gson ยป gson
you can see that in the Runtime Dependencies section from here
In order to rectify this, you have to add it as a plugin
like below
plugins {
id 'org.jetbrains.kotlin.<...>' version '1.5.0'
}
This is the recommended way from here

React native screens configuration failed

trying to build an android project,and gradle fails with this exception:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':react-native-screens'.
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'archiveClassifier' for task ':react-native-screens:androidJavadocJar' of type org.gradle.api.tasks.bundling.Jar.
According to the PR that created this change you need Gradle 4.10+. So if you update it should work again. You need to update the version of the gradle plugin to 3.3.2 as well. I'm not sure but I do think you could even update to Gradle 5.x and build plugin 3.4+.
Link referenced to Create My Answer

Adding sub module to project causing gradle build failures in Android studio 3.0 with gradle version 4.1

I added sub module library vertical-stepper-form version 0.9.8, while I set dependency of this library on my app module. I was able to do it successfully.
I am using Android Studio 3.0 with gradle version 4.1, few of the classes in project are in kotlin and others in java
When I started gradle sync it gave me this error. The gradle is not building and showing below issues :
/*********************************/
Information:Gradle tasks [:vertical-stepper-form:generateDebugSources,
:vertical-stepper-form:generateDebugAndroidTestSources,
:vertical-stepper-form:mockableAndroidJar,
:app:generateInstallDebugSources,
:app:generateInstallDebugAndroidTestSources, :app:mockableAndroidJar]
D:\Devavrata\project/package/src/main/res/abc.xml Error:error:
attribute 'com.spireon.install:src' not found.
D:\Devavrata\AbcProject\abc-Android\app\build\intermediates\incremental\mergeInstallDebugResources\stripped.dir\layout\activity_main.xml
Error:attribute 'com.spireon.install:src' not found. Error:failed
linking file resources. Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error:
check logs for details Error:Execution failed for task
':app:processInstallDebugResources'.
Failed to execute aapt Information:BUILD FAILED in 24s Information:7 errors Information:0 warnings Information:See complete output in
console
/********************************/
What I have already tried :
I tried with changing import lines in xml also changing the android:src and srcCompat properties. Along with build/project cleaning and invalidating the cache.
Changing this line in gradle.properties
android.enableAapt2=false
Let me know if anyone has faced this issue

springfox 2.2.3 snapshot dependencies adding failed because of missing nexus-maven-repository-index.properties

I setup my project with springfox 2.2.3 snapshot version in IDEA 14 with gradle. I follow instruction 2.1.1. Gradle Snapshot. I failed with error that maven repository cannot be indexed and see exception in IDEA's log:
WARN - #org.jetbrains.idea.maven - Failed to update Maven indices for: [com.intellij.util.CachedValueImpl#a1d13c] http://oss.jfrog.org/simple/oss-snapshot-local/io/springfox
org.jetbrains.idea.maven.server.MavenServerIndexerException: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
I tried both repositories and both failed:
http://oss.jfrog.org/simple/oss-snapshot-local/io/springfox/
http://oss.jfrog.org/oss-snapshot-local/io/springfox/
Could anyone have any idea how to fix the issue?
I tried to download dependencies manually and put them in my local .m2 directory and setup in gradle mavenLocal() instead of maven {url ...} but my attempt failed with IDEA's warning on Gradle refresh operation:
Warning:<i><b>project ':data-service': Web Facets/Artifacts will not be configured</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':data-service:runtime'.
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.springfox:springfox-swagger2:2.2.3-SNAPSHOT.
Required by:
parseq:data-service:2.4.0 alpha</i>
Now I think that should also manually add transitive dependencies for springfox package. But it looks ugly and I think I should not go this way.
Does anyone has idea what should I do?
I found issues with dependency donwloading:
* when I work from corporate network I have SSL certificate issue
* initially I added maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' } into buildscript {...} section, I changed it to repositories {...} and fixed the issue
* also I updated my gradle to 2.4 version (but it didn't help)
Now my starting issue is fixed.