I refer this link Error : Ambiguous method call. Both findViewById (int) in AppCompactActivity and Activity to solve but there is no import android.app.Activity and also if I convert my import android.support.v7.app.AppCompatActivity into android.app.Activity then the error goes but I want to use AppCompatActivity.
I also update all libraries in SDK and also invalidate and restart but nothing works.
why this error occurs and how to solve this?
I guess you have something like that
ViewClass view = (ViewClass)findViewById(R.id.view);
in your code and you'd updated API level? If so, change your code to
ViewClass view = findViewById(R.id.view); // without redundant cast
The findViewById
method signature was changed in API 25, please refer to SDK
If you recently updated your project to API 26, try doing invalidate caches/restart, then re-sync gradle.
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