Build custom SDK with AOSP changes

随声附和 提交于 2020-01-22 03:07:29

问题


I am trying to build my app (uses many hidden api and properties) in android studio. I have modified the AOSP code to expose these hidden apis. In order to make the build successful I have added the classes.jar as the external lib to my project. But that doesn't resolve the issue. It was still showing errors :

error: cannot find symbol method getService()   
error: cannot find symbol variable userSetLocale    
error: cannot find symbol method getInstance()  
error: cannot find symbol variable INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH  
error: cannot find symbol variable INJECT_INPUT_EVENT_MODE_ASYNC    

Now I am trying to make the custom SDK with this modified AOSP code.

Note : Already tried and failed with the following solutions

  • Exposing hidden APIs android L (SDK 21) in Android Studio

  • How do I build the Android SDK with hidden and internal APIs available?

  • https://github.com/anggrayudi/android-hidden-api

Can anyone help to build custom SDK based on the modified AOSP code


回答1:


Add the following in you root project's build.gradle. ${rootDir}/libs/framework.jar is the jar build from you aosp code.

subprojects {
gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs.add("-Xbootclasspath/p:${rootDir}/libs/framework.jar")
    }
 }
}

There are red errors in the editor. But it can be build successful. Demo project:https://github.com/auxor/AppWithModifiedFramework/




回答2:


I solved the issue by changing the orderEntry of sdk in app.iml and giving the absolute path of framework.jar in modules build.gradle



来源:https://stackoverflow.com/questions/59608173/build-custom-sdk-with-aosp-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!