To use Android Annotations prior to 2.3.0 a person would do this:
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
to use Kotlin you would use kapt
instead of apt
(link).
Since 2.3.0 a person needs to use the annotationProcessor instead of apt:
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
Does anyone know what needs to change in order to use Kotlin with the annotationProcessor?
I currently have a very simple, main activity that I set up to use @EActivity
to grab the layout. I declared the generated file in the manifest, .MainActivity_
.
In java, this works fine. In Kotlin:
@EActivity(R.layout.activity_main)
open class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
I get a runtime error:
Process: [...], PID: 10018 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{[...].MainActivity_}: java.lang.ClassNotFoundException: Didn't find class "[...].MainActivity_" on path: DexPathList[[zip file "/data/app/[...]-1/base.apk"],nativeLibraryDirectories=[/data/app/[...]-1/lib/x86, /vendor/lib, /system/lib]]
**** UPDATE ****
So I cleaned and rebuilt the project. It seems annotations isn't generating the underscore file for MainActivity. Makes sense but I don't know why or how to fix it.