Migrating AndroidX Run Error Does Not Exist

- 1 answer

I just have migrated my project to AndroidX. Sync and build phase are ok, but when I try to run the compiler show me this error:

error: package does not exist

This error raises on a builded file

// Generated code from Butter Knife. Do not modify!
package com.xdatanet.cda.Adapters;

import; //<-- Doesn't exists
import; //<-- Doesn't exists
import android.view.View;
import android.widget.ImageView;
import butterknife.Unbinder;
import butterknife.internal.Utils;
import com.xdatanet.cda.CustomView.CDATextView;
import com.xdatanet.cda.R;
import java.lang.IllegalStateException;
import java.lang.Override;

public class CommunicationAdapter$CommunicationViewHolder_ViewBinding implements Unbinder {
  private CommunicationAdapter.CommunicationViewHolder target;

  @UiThread  //<-- First error
  public CommunicationAdapter$CommunicationViewHolder_ViewBinding(CommunicationAdapter.CommunicationViewHolder target,
      View source) {
      // Some generated code

  @CallSuper //<-- Second error
  public void unbind() {
      // Some generated code

Gradle properties


Butterknife implementation into gradle

implementation "com.jakewharton:butterknife:8.8.1"
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"

The IDE says Files under the "build" folder are generated and should not be edited.

  • Android Studio 3.2.1
  • Min Sdk 19, Max Sdk 28
  • Gradle version 3.2.1

It seems to be an error with butterknife but I don't know why.



I would suggest updating ButterKnife to the newest version.

I haven't migrated my projects to AndroidX yet, but from the commit history on the ButterKnife github page, it would seem like that the newest 9.0.x versions support AndroidX.