问题
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