android.os.ServiceManager not found while building

2020-07-22 10:03发布

问题:

I am getting following error while building android source, where i have added my custom app which uses android.os.ServiceManager.

cannot find symbol
symbol  : class ServiceManager
location: package android.os
import android.os.ServiceManager;

Why am I facing this error, actually this import can be found in many other app in android source.

I am building the android source as in http://source.android.com/source/building.html and also followed this post The import android.os.ServiceManager cannot be resolved answers.

and for more info, I am building in [android root]/packages/app/ directory

Please can anybody help me to solve this ?

回答1:

solved :) Have to remove LOCAL_SDK_VERSION := current from Android.mk file