Search code examples
androidandroid-studioimporterror

Question on "Cannot resolve symbol" when trying to import files from Android 19 API


I am using Android Studio and getting the error, "cannot resolve symbol" when trying to import the following libraries:

import android.os.ServiceManager;
import android.os.storage.IMountService;
import android.os.storage.StorageEventListener;

Why do I get these errors? I can view the files ServieManager.java, IMountService.java, and StorageEventListener.java in Android Studio (Press Shift twice, and type in the file name - ServiceManager.java for example - and verify the file shows up. My IDE recognizes the file is there).

Looking at the attached picture below, it seems ServiceManager.java is part of the android 19 API: enter image description here


Solution

  • None of those classes are part of the Android SDK. For example, you will not find them in the published documentation. They are part of the implementation of Android, but they are not part of the public API of Android.

    As a result, Android SDK projects cannot reference them.