Android Studio and Kotlin - not loading changes - android

To load a fresh APK I am required to clean every time before building. It is like the compiler isn't noticing my code changes.
Here are my configurations:
My project is entirely in Kotlin
Kotlin version 1.1.60
Gradle version 4.4
Android Build Tools version 3.1.0-alpha04
Android Studio 3.0 (stable)
Java 8
Databinding is enabled
Using Kapt
Instant run is disabled
I haven't confirmed if Java code would show the same problems or not.
Has anyone seen this and found a way around it?

Related

Android Studio 3.1 Canary 3 - Gradle project sync failed

Using Android Studio 3.1 Canary 3 for Android application development using Kotlin, whenever the studio is opened, I get the following error
Gradle project sync failed. Basic functionality(e.g editing debugging) will not work properly
It is not the issue relevant to the built-in kotlin in Android studio version3.0 and above but the Kotlin plugin's
This is a common issue that occurs when you import all the settings from your old version of Android Studio (where you would have already installed Kotlin in plugins) to Android Studio 3 and 3.1
So, to rectify the issue go to
Preferences -> Plugins -> Search for Kotlin and Uninstall
since we have built-in Kotlin support in the latest Android Studios, we may not need this Kotlin plugin anymore
Hope this helps!

jacoco android gradle plugin empty report on android kotlin project after bumping android gradle plugin to version 3 (beta)

On a android project written in kotlin I'm using jacoco-android-gradle-plugin to generate the code coverage report for unit tests.
The report is fine when using version 2.3.3 of the android gradle plugin, but it's empty when upgrading to version 3 (beta). Same behaviour on Android Studio 3 (beta) when setting the jacoco code coverage runner (not the built-in intellij one).
I know the android gradle plugin 3 and android studio are still in beta, but I was wondering whether there is a workaround for this?
Alessandro

Kotlin Kapt doesn't show databinding errors when running from Android Studio

I'm using Kotlin kapt version 3, whenever there is a problem with databinding, the build from Android Studio fails with a very generic error:
Error:Execution failed for task ':app:kaptDev21DebugKotlin'.
> Internal compiler error. See log for more details
When I run the same task from the console, the real problem shows up. Somehow the AS doesn't show this error in message window.
I'm using Android Studio version 2.3.3
You can see the error in Gradle Console, something similar to this :
Android Studio 3.0 and later version of android studio support Kotlin better. AS 3.0 comes with default support with Kotlin as AS 2.3 requires a plugin to be installed.
Android Studio Team from google and IDEA intellij Team from JetBrain working together to make Kotlin compatible with Android Studio.
Right now 3.0 version comes with Canary version(Preview version) and every week a new preview version (Canary 1, Canary 2 ... and so on) rolls out fixing reported bugs.
So you should try Android Studio 3.0 Canary 9 latest version as of now.
If still problem persists, report this bug.

Android Studio 2.2 cannot find references for all kotlin files

After updating to Android Studio 2.2, I keep getting the error "Unresolved reference" in all kotlin files.
The specific failing gradle task is:
:app:compileStagingDebugKotlinAfterJava (for a variant called StagingDebug)
The only solution I've found so far is to run clean. But I don't want to run this every time in do changes in my code. Any help?
Make sure the kotlin plugin version in Android studio and the kotlin version that you are using(check build.gradle) are the same.
After updating AS please configure your project again like described below: https://kotlinlang.org/docs/tutorials/kotlin-android.html
Always choose Stable channel for Kotlin updates.
I don't think that 1.0.4 version is already in stable channel. Why? The latest version is compatible with the latest version of IntelliJ IDEA, so it may cause problems in the Aandroid Studio which does not follow IDEA versions.
Hope it will help

Android Studio taking too long to build

Android Studio
I am using Stable version Android Studio 2.1. But it is taking very long to build. Currently I have used gradle 2.10 and that too a local version of it. I am using gradle plugin 2.0.0 right now and using jdk 1.8 along with all the options required for Instant run enabled on Studio settings. I even tried with offline options and tried using gradle wrapper also.
My studio is taking very much time to build more than half a hour many a times. Can some body help me out in speeding it up. Am I missing something or using a wrong gradle plugin for Studio 2.1.

Categories

Resources