如何在Android源代码包中添加外部库,例如Retrofit和butterknife? [英] How to add external libraries such as Retrofit and butterknife in Android Source code packages?

查看:109
本文介绍了如何在Android源代码包中添加外部库,例如Retrofit和butterknife?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在根据AOSP源代码构建自定义rom

I am building a custom rom from AOSP source code

我首先决定通过下载并导入Android Studio从AOSP源代码树中编辑一些AOSP应用程序

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

我选择了ExactCalculator进行训练

I selected ExactCalculator for training

但是AOSP没有Build.gradle来添加我的依赖项.

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

我添加了一些材料组件,还添加了Android Studio build.gradle中的Retrofit ,Gson, Butterknife and dagger 2,并通过AOSP股票精确计算器中的API实施了货币转换器

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

现在我用修改后的srcs覆盖了AOSP中的packsage src文件夹

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

但是现在我的疑问是,由于AOSP源代码中的软件包没有仅build.gradle Android.mk,我如何添加该库来构建AOSP源?

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?

推荐答案

应在AOSP内构建的库需要具有Android构建配置.由于Android 8是(Android.mk文件仍受支持).

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似乎已经集成: https://android.googlesource.com/platform /external/dagger2/ 您可以将其添加到您的回购清单中,以将其包含在AOSP中.

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.

创建Android构建配置的另一种方法是包括预构建的二进制文件.但是您将必须弄清楚在用例上在技术上和法律上是否可行.

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.

这篇关于如何在Android源代码包中添加外部库,例如Retrofit和butterknife?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆