-1

I am new to Android development, and was wondering why a library like AudioManager (android.media.AudioManager) can be used, but when I try to navigate to the code of AudioManager, half the source code is red.

For example, it says,

cannot resolve symbol SystemService"

Do I need to add some kind of dependency somewhere?

This means that when I debug through AudioManager, the bytecode does not match what appears on the screen and the debug is useless.

I've tried looking at other posts and changing my SDK version to 27 and my minimum version up to 23.

Thanks in advance.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Philip
  • 638
  • 1
  • 8
  • 22

4 Answers4

0

This seems to be an IDE error, typically when I am getting build errors caused by this, Invalidate Caches and Restart will fix this. You can find it by searching in the help menu or under File in Android Studio

Nick Mowen
  • 2,572
  • 2
  • 22
  • 38
0

You could try below points as it worked-out for it :

  • Exit Android Studio
  • Back up your project
  • Delete all the .iml files and the .idea folder
  • Relaunch Android Studio and reimport your project
  • By the way, the error messages you see in the Project Structure dialog are bogus for the most part.
Priti Rathod
  • 117
  • 1
  • 10
  • tried this, thanks, but it didn't work. I believe the answer to my question is in the post https://stackoverflow.com/questions/4446469/the-import-android-os-servicemanager-cannot-be-resolved. – Philip May 02 '19 at 07:00
0

try to update your Android studio, they always working for something like this. I recommend AS 3.3

Roberto Capah
  • 353
  • 1
  • 3
  • 9
0

Thanks to all for trying to answer. I found the answer to my question here: The import android.os.ServiceManager cannot be resolved.

Explanation:

Apparently the reason AudioManager had so many reds is because it depends on many "hidden" classes, that are purposely excluded from the .jar libraries. The @hide in https://github.com/commaai/android_frameworks_base/blob/master/media/java/android/media/IAudioService.aidl is one example.

Philip
  • 638
  • 1
  • 8
  • 22