I work on Android Studio with Gradle.
My issue is Non-constant Fields in Case Labels.
When I use Butter Knife in Android lib, I get the following error:
tutuFragment.java:31: error: attribute value must be constant
@InjectView(R.id.noContactTV)
Has anyone experienced the same issue, and if so, have a solution for it?
According to https://github.com/JakeWharton/butterknife
Library projects
To use Butter Knife in a library, add the plugin to your buildscript:
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0' } }
and then apply it in your module:
apply plugin: 'com.android.library' apply plugin: 'com.jakewharton.butterknife'
Now make sure you use R2 instead of R inside all Butter Knife annotations.
class ExampleActivity extends Activity { @BindView(R2.id.user) EditText username; @BindView(R2.id.pass) EditText password; ... }
So it's now to possible to use Butterknife
injects in Android libs.
Hope it will help
Butterknife does not support library projects at this time, please refer to https://github.com/JakeWharton/butterknife/issues/100 for more informataion.
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