user3499427
user3499427

Reputation:

Attempt to use @BindView for an already bound ID 0

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;

Upvotes: 0

Views: 3268

Answers (3)

Enylton Machado
Enylton Machado

Reputation: 121

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.

Upvotes: 2

Positive Navid
Positive Navid

Reputation: 2781

Short Answer:

Under:

build.gradle

change:

classpath 'com.android.tools.build:gradle:3.6.0'

to:

classpath 'com.android.tools.build:gradle:3.5.3'

Long Answer:

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'

to

    classpath 'com.android.tools.build:gradle:3.6.0'

and

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

to

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.

Upvotes: 4

OstAlex
OstAlex

Reputation: 125

Upgrade the version of butterknife to 10.2.1

Upvotes: 8

Related Questions