Tuesday, 2 October 2018

Android Studio adds both @androidx.annotation and @android.support.annotation.Nullable problem

I updated Android Studio to version 3.2.0.

When I accept any change from list of suggestion or alt + enter.

  • Problem is @androidx.annotation auto created.
  • Thus suggestions method have two annotation @androidx.annotation.Nullable and android.support.annotation.Nullable.
  • I don't want to manually remove this unwanted suggestion, so what can I do to have only android.support.annotation?
  • Also androidx.annotation package is not added in my app. and I don't want to add androidx.annotation.

See example.

import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

public class LoginActivity extends AppCompatActivity {
    @Override
    public void onCreate(@androidx.annotation.Nullable @Nullable Bundle savedInstanceState, @androidx.annotation.Nullable @Nullable PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
    }
}

Is there some IDE setting to remove auto generation of androidx.annotation?

Update

I could get rid of this problem with migrating to androidx (from official doc), but I am not able to migrate all projects to androidx currently. So need a solution.



from Android Studio adds both @androidx.annotation and @android.support.annotation.Nullable problem

No comments:

Post a Comment