Android Studio 2.1.3 的 WSO2 代理编译错误

WSO2 agent compilation error with Android Studio 2.1.3

我按照 Wiki (https://docs.wso2.com/display/EMM201/Creating+a+New+Android+APK+File) 中的说明使用 Android Studio 2.1.3 编译项目。但它给了我以下错误:

C:\shared\source\product-mdm\modules\mobile-agents\android\client\client\src\main\java\org\wso2\emm\agent\services\NetworkConnectedReceiver.java
Error:(42, 28) error: cannot find symbol method startServiceAsUser(Intent,UserHandle)
C:\shared\source\product-mdm\modules\mobile-agents\android\client\client\src\main\java\org\wso2\emm\agent\utils\CommonUtils.java
Error:(432, 11) error: cannot find symbol method startServiceAsUser(Intent,UserHandle)
Error:(445, 11) error: cannot find symbol method startServiceAsUser(Intent,UserHandle)
Note: Some input files use or override a deprecated API.

知道如何解决这个问题吗?

startServiceAsUser 是框架内部 API 的一部分,这不是 public API。要编译它,您需要使用 android.jar,它是使用原始 Android Open Source Project (AOSP)

构建的

repository 包含为所有 SDK 版本启用隐藏 API 的 android.jar。您可以下载与您的 SDK 版本相关的 jar 并将其替换为通常位于 /platforms/android- 路径的本地 android.jar 文件并重建代理。