I updated my AS from 3.0 to 3.1. After fixing several issues that showed up with the update, I am stuck at making Kotlin work.
Kotlin code compiles and runs, although I can't edit kotlin files. Kotlin keywords are not recognised by the editor, using kotlin code from java classes appear red and in general I can't really do anything with kotlin.
I use:
buildscript {
ext.kotlin_version = '1.2.41'
...
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
kotlin plugin: 1.2.41-release-Studio3.1-1
and org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version
Related
I want to generate a signed bundled with IntelliJ IDEA but I always get this error no matter what I'm doing. I tried to upgrade to the Android Gradle version. I even downloaded Android Studio and set everything(updating the Gradle, sync, etc) but still the same error during the same project. Any idea how to fix it?
I took a screenshot of the error:
https://i.stack.imgur.com/dwTup.png
try to make your android level Gradle dependencies look like this:
dependencies { classpath 'com.google.gms:google-services:4.3.5' classpath 'com.android.tools.build:gradle:3.6.4' }
the gradle:3.6.4 works for me
You need to add the following line to your dependencies block
classpath 'com.google.gms:google-services:4.3.5'
For a clean code I would suggestyou parametrize the version number, so you would add the following line to buildscript block:
ext.gradle_version = 'x.y.z' // Replace with that in your current build.gradle
ext.googleservices_version = '4.3.5'
and dependencies will look like
dependencies {
classpath 'com.google.gms:google-services:$googleservices_version'
classpath 'com.android.tools.build:gradle:$gradle_version'
}
I am getting the following error while trying to build my project on Android Studio:
ERROR: No signature of method:
com.crashlytics.tools.gradle.CrashlyticsPlugin.findObfuscationTransformTask()
is applicable for argument types: (java.lang.String) values:
[DevDebug]
How to solve this?
EDIT: Before proceeding to the solution below, please at first update to the latest stable version of fabric gradle tools and check if the problem is fixed. At the time of this edit, some claim that updating to version 1.31.2 has fixed the issue.
This seems to be an issue related to version "1.28.0" of "io.fabric.tools:gradle".
Usually this kind of problem occurs if groupId:artifactId:n.+ structure of versioning is used inside dependency (app level/project level). In this case:
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
Because it auto updates the version, and as a result, if there is any fatal error in the latest version, the project is likely to face a crash due to build/runtime error.
Android Studio always suggests: 'Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds...'
One working solution was found to be downgrading to a specific previous version like 1.27.1 or any other stable latest version prior to 1.28.0, like:
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
Remember to check both gradle files (app level/project level) to see where the above dependency has been declared and change accordingly.
hey this error raised because of Many android developers uses
classpath 'io.fabric.tools:gradle:1.+'
like this so that compiler not find exactly match of the fabric version and error raise and also M. Arabi Hasan Sakib is right
classpath 'io.fabric.tools:gradle:1.28.0'
also raise this type of error, solution mentioned by M. Arabi Hasan Sakib is also working. I tried below code and its working for me hope it works for you people also or just replace the line like
classpath 'io.fabric.tools:gradle:1.27.1':
(Put this code into the build.gradle in app directory)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url "http://dl.bintray.com/lukaville/maven"
}
}
I wanted to update the version of my kotlin plugin to 1.3.10. This is what looks like my build.gradle :
buildscript {
ext.kotlin_version = '1.3.10'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Then i want to define a variable for my kotlin-stdlib :
ext.kotlinDependency = "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
But it does not work for this last line, I have always done this way and it worked well for the 1.2.61 version. Should i just wait before updating the version for the last one ?
As the Kotlin 1.3 compatibility guide says,kotlin-stdlib-jre7 is a deprecated artifact name which has been removed in Kotlin 1.3. kotlin-stdlib-jdk7 is the replacement to be used.
After couple of months of not working on my app I have decided to continue and before doing so I wanted to update all dependencies, libraries etc.
After 3h+ of a nightmare with googles nonsense I am at the final (probably not even close) stage.
This error of:
The Android Gradle plugin supports only Crashlytics Gradle plugin
version 1.25.4 and higher.
Is driving me nuts. I did a global search on my project of 1.25.4 and 1 result came up which was for the classpath 'io.fabric.tools:gradle:1.25.1' so I changed it to classpath 'io.fabric.tools:gradle:1.25.4' and hoped for the best.. But the same error keeps coming up every time I am trying to build the app..
Can anyone tell me what kind of magic potion should I spray this gradle so it actually starts to work?
add this to the root project's build.gradle:
buildscript {
repositories {
...
maven { url "https://maven.fabric.io/public" }
}
dependencies {
...
classpath "io.fabric.tools:gradle:1.26.1"
}
}
and this on top of the module level's build.gradle:
apply plugin: "io.fabric"
Updated 21.06.2015
I wanna try kotlin and android databinding in a same project. But when I add to kotlin-gradle-plugin dependency I cannot build even an empty project anymore with error:
cannot generate view binders java.lang.NoClassDefFoundError: kotlin/jvm/internal/ExtensionFunctionImpl
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta3'
classpath "com.android.databinding:dataBinder:1.0-rc0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.613"
}
}
Any workaroud to make it work together?
Unfortunately,this is caused by a kotlin version inconsistency between databinding and kotlin plugin.
We'll remove kotlin dependency from the plugin on rc1 but until then you would need to use kotlin 0.11.91.
Also, since kotlin's annotation processor support is limited at this moment and data binding is using annotation processor; they probably won't work well (though I have not tried).