相关文章推荐
大方的香烟  ·  JavaScript Array ...·  3 月前    · 
文武双全的蚂蚁  ·  PHP输出 ISO ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Android Studio Build fails with:

Attempt to use @BindView for an already bound ID 0 on 'mConnectionMessage'
Fragment.java:53: error: Attempt to use @BindView for an already bound ID 0 on 'mConnectionMessage'. 
    ImageView mConnectionImage;

Here's the part of the code that causes the problem:

    @BindView(R2.id.display_discovery_state_icon)
    ImageView mConnectionImage;

Android Studio update is the root cause of the issue.

Here's the update:

"To take advantage of the latest features, improvements, and security fixes, we strongly recommend that you update the Android Gradle plugin from the current version 3.5.3 to version 3.6.0 and Gradle to version 5.6.4. Release notes"

which changes:

    classpath 'com.android.tools.build:gradle:3.5.3'
    classpath 'com.android.tools.build:gradle:3.6.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

The problem can be reproducible merely by making the above changes manually (not necessarily running the update).

Note: I could reproduce the problem and fix, both on windows and mac.

@MustafaHussain I want to be more conservative and word it like: "Gradle update causes a bug" :) – Positive Navid Mar 14, 2020 at 1:52

Are you using butternife?
In my case, I upgraded to version 10.2.1 (com.jakewharton:butterknife-gradle-plugin:10.2.1) and no longer received the message.

I'm using gradle 3.6.1.

Great! Thanks bro, this gonna make me add view binding side by side to ButterKnife to replace it. – Mahmoud Elshamy Aug 9, 2021 at 6:21

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.