When I place the following code into my Android Studio for the first time, it highlighted a lot of errors:
import java.util.List;
public void enableAutofocus()
{
    camera = camera.open();
    Camera.Parameters parameters = camera.getParameters();
    List<String> focusModes = parameters.getSupportedFocusModes();
    if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO))
    {
        parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
    }
    camera.setParameters(parameters);
}
So, I did alt+enter and it inserted the right import:
import android.hardware.Camera;
import java.util.List;
public class OcrFocusPluginClass
{
    public void enableAutofocus()
    {
        camera = Camera.open();
        Camera.Parameters parameters = camera.getParameters();
        List<String> focusModes = parameters.getSupportedFocusModes();
        if ( focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO) )
        {
            parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
        }
        camera.setParameters(parameters);
    }
}
But then immediately, the lower-case cameras now have red underlines.
I realised the Camera interface was deprecated, so I included the new android.hardware.camera2 API for new applications:
import android.hardware.camera2;
But now in addition to the camera code, all the focus code is again highlighted wrong.
What am I missing?

 
    