How to add external libraries such as Retrofit and butterknife in Android Source code packages?

雨燕双飞 提交于 2019-12-11 18:05:00

问题


I am building a custom rom from AOSP source code

I first decided to edit some AOSP apps from AOSP source tree by downloading and importing to Android Studio

I selected ExactCalculator for training

But the AOSP don't have Build.gradle to add my dependencies .

I added some material components and also Retrofit ,Gson, Butterknife and dagger 2 in Android Studio built.gradle and implemented currency converter via an API in AOSP stock Exact Calculator

Now I overwritten the packaage src folder in AOSP with my modified srcs

But now my doubt is , since packages in AOSP source code don't have build.gradle only Android.mk, how can I add this libraries for building the AOSP source?


回答1:


Libraries that shall be built inside the AOSP need to have an Android build configuration. Since Android 8 that would be an Android.bp file for Soong (Android.mk files are still supported for now though).

Dagger2 seems to be already integrated: https://android.googlesource.com/platform/external/dagger2/ You could just add it to your repo manifest to include it in your AOSP.

An alternative to creating Android build configurations is to include prebuilt binaries. But you will have to figure out whether that is technically and legally possible for your use-case.



来源:https://stackoverflow.com/questions/57871822/how-to-add-external-libraries-such-as-retrofit-and-butterknife-in-android-source

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