Build ignores Kotlin changes with Retrolambda 3.1.0
See original GitHub issueHere’s a test project: https://github.com/cypressious/KotlinRetrolambdaBug
Run the app. The activity should display “bar”. Now go to com.cypressworks.kotlinretrolambdatest.Foo
and change "bar to “foo”. Run the app again. You will see “bar” again.
Gradle prints:
:app:compileDebugKotlin
:app:compileDebugJava UP-TO-DATE
:app:compileRetrolambdaDebug
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
Notice how, despite compileDebugKotlin and compileRetrolambdaDebug being not up-to-date, the rest of the tasks was skipped?
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Android build with retrolambda ignores source code changes
In our project we use gradle + retrolambda + proguard. Retrolambda incremental build is set to false. Sometimes build passes without error but...
Read more >Realm: Create reactive mobile apps in a fraction of the time
Once you make these two changes, simply refresh your gradle dependencies. ... Dynamic Realm ignores any configured schema, migration, and schema version.
Read more >Navigation | Android Developers
To generate Java language code suitable for Java or mixed Java and Kotlin modules, add this line to your app or module's build.gradle...
Read more >Archinamon / android-gradle-aspectj Download - JitPack
Full support of Android product flavors and build types. Support Kotlin, Groovy, Scala and any other languages that compiles into java bytecode.
Read more >Android Studio 3.1 in stable channel : r/androiddev - Reddit
It seems to work very well without any changes to build process and such. ... I'm getting errors with the 3.1.0 gradle plugin....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s a version of @sfunke’s workaround that’s more generic (works with flavors) and possibly a bit faster:
Seems to also work with JRebel for Android.
EDIT: In version 1.3.0 of the Android Gradle plugin, the task name seems to have changed to
compile${var.name.capitalize()}JavaWithJavac
.If anyone is interested, my workaround, based on @cypressious 's inspiration and my own limited gradle knowledge. (Just relates to debug build variant, but fits my needs very well.)
I am able to use latest retrolambda gradle plugin (3.2.0)
Explanation: As project is being evaluated, an execution block is added to the compileDebugKotlin task, so whenever that task is run (and our java classes are considered dirty), the compileDebugJava task’s output upToDate-flag is set to false (so compileDebugJava is being forced to run).
Hacky and raw, but gets the job done.