When trying to build, I get this stacktrace:
Exception in thread "main" java.lang.NullPointerException: Couldn't find outer class com/xxx/CheckListPresenter$onAttached$1$5 of com/xxx/CheckListPresenter$onAttached$1$5$1
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:1079)
at com.google.devtools.build.android.desugar.ClassVsInterface.isOuterInterface(ClassVsInterface.java:56)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitOuterClass(InterfaceDesugaring.java:246)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:638)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
I checked the CheckListPresenter
class and there doesn't appear to have any issues. I tried deleting the class just to see if it would build, but the error just moved on to another class stating the same issue.
The last time I touched this code was a good few months ago, so I am not sure what triggered the change.
Things that may matter: This is an Android project. This is written in Kotlin. This fails on the transformClassesWithDesugarForDebug
gradle task
These are all just stabs in the dark I tried:
Creating a new project and moving in only my source code and gradle files.
Dropping from java 8 to 7.
Different version of JDK. I have tried 1.8.0_151 and 1.8.0_152.
Adding javaMaxHeapSize "4g"
to build.gradle.
Upgrading everything: gradle wrapper and every dependency.
Removed Dagger in favor of Koin
Removed Kapt
Used both Preview and Stable releases of Android Studio
Here is my build scan for what good it will do
This is the snippet of code that is killing me:
view?.let { v ->
v.getCancelClicks()
.doOnSubscribe({ disposables.add(it) })
.subscribe({
v.showExitDialog()
.filter { it }
.subscribe({
cancel()
}, this::onError)
}, this::onError)
}
What is strange, is neither one of these alone will give me issues
view?.let { v ->
v.getCancelClicks()
.doOnSubscribe({ disposables.add(it) })
.subscribe({
//removed
}, this::onError)
}
}
or
view?.let { v ->
v.showExitDialog()
.filter { it }
.subscribe({
cancel()
}, this::onError)
}
But together they are a problem.
Something else of note, view
is defined in the base class and is a generic.
Currently, my work around is to remove view?.let{
and just use view!!
. This is obviously a bug, but I am not sure who to report it to. Gradle, Kotlin, JetBrains, God?
The problem resolved itself when I added android.enableD8.desugaring = true
to gradle.properties
I have a way to work around this error: java.lang.NullPointerException: Couldn't find outer class com/iconfitness/iconaudit/common/fragments/SettingsFragment$onCreate$1$1 of com/iconfitness/iconaudit/common/fragments/SettingsFragment$onCreate$1$1$1
.
Just move this block code
v.showExitDialog()
.filter { it }
.subscribe({
cancel()
oo other method. I don't meet this problem anymore. I hope this will help you.
The issue is filed here https://issuetracker.google.com/issues/72750890.
Both solutions mentioned there worked for me:
adding classpath 'com.android.tools.build:gradle:3.0.1'
to build.gradle or adding android.enableD8.desugaring=true
to gradle.properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With