There is a possibility that appybuilder code editor uses an old android library, which doesn’t have the classes that was added in new API versions (API 28), and therefore, the JAVA compiler can’t find the class you imported.
AndroidRuntime:
[javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/anshmishra2166/Newproj/Newproj.java:5: error: cannot find symbol
[javac] import android.widget.Magnifier;
[javac] ^
[javac] symbol: class Magnifier
[javac] location: package android.widget
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/anshmishra2166/Newproj/Newproj.java:6: error: package android.widget.Magnifier does not exist
[javac] import android.widget.Magnifier.Builder;
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warning