the binded view is null after adding bindview in activity and fragment,
I'm using kotlin, so the code is as below in app gradle:
implementation "com.jakewharton:butterknife:$butterknife_version"
kapt "com.jakewharton:butterknife-compiler:$butterknife_version"
and as below in project gradle:
ext.butterknife_version = '9.0.0-SNAPSHOT'
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "com.jakewharton:butterknife-gradle-plugin:$butterknife_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
This is not enough information to diagnose a problem. Please provide a self-contained sample or failing test case.
Kotlin.zip
@JakeWharton
Anyone could help on this issue please? I haven't found the root cause, only me meet this issue?
this attached project doesn't popup NullPointerException, but still doesn't make sense, it must set version as 9.0.0-SNAPSHOT in project build.gradle, while must set version as 8.8.1 in app build.gradle, if all use 9.0.0-SNAPSHOT, the NullPointerException will happen, and if all use 8.8.1, the build error will happen
fuck.zip
@zhijiazheng123 - You may be experiencing the same problem I reported on Stack Overflow: https://stackoverflow.com/q/48971092/315702
For us, the solution was to downgrade to Butterknife 8.5.1.
actually I've found the solution, no need to downgrade
please help close this issue, thanks all!
@JakeWharton
@zhijiazheng123 what is the solution?
@zhijiazheng123 Kindly write down your solution. It will be helpful for the community.
though this is closed, maybe it might help someone. It's a summary of @zhijiazheng123's solution
Bug cause : Mixing kotlin and java in the project (on my project)
on your project gradle:
buildscript {
ext.kotlin_version = '1.3.31'
ext.butterknife_version = '10.1.0'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-beta01'
classpath 'com.google.gms:google-services:4.2.0'
classpath "com.jakewharton:butterknife-gradle-plugin:$butterknife_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
then on your gradle (app level)
dependencies {
//for java
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
// kotlin
api "com.jakewharton:butterknife:$butterknife_version"
kapt "com.jakewharton:butterknife-compiler:$butterknife_version"
this fixed my issue
Most helpful comment
@zhijiazheng123 what is the solution?