如何在 Eclipse 中将一个 android 项目转换为一个库项目? [英] How to convert an android project into a library project in Eclipse?
问题描述
我想将一个android项目转换成一个库项目.可以这样做吗?
I want to convert an android project into a library project. Can this be done?
我正在尝试在另一个项目中使用这个项目.
I am trying to use this project in another project.
推荐答案
Android Studio 选项的更新
Update for Android Studio option
将应用模块转换为库模块
如果您有一个包含所有要重用的代码的现有应用模块,您可以将其转换为库模块,如下所示:
If you have an existing app module with all the code you want to reuse, you can turn it into a library module as follows:
打开现有应用模块的 build.gradle 文件.在顶部,您应该看到以下内容:
Open the build.gradle file for the existing app module. At the top, you should see the following:
apply plugin: 'com.android.application'
更改插件分配,如下所示:
Change the plugin assignment as shown here:
apply plugin: 'com.android.library'
点击将项目与 Gradle 文件同步
.
就是这样.该模块的整个结构保持不变,但它现在作为一个 Android 库运行,并且构建现在将创建一个 AAR 文件而不是 APK
详细了解如何创建 Android 库 以及如何转换现有项目到 Android Studio 中的库项目
以下步骤适用于 Eclipse
Below steps are for Eclipse
步骤是
Right click on project -> property -> Android -> check 'Is library' check box -> OK
就是这样.
这篇关于如何在 Eclipse 中将一个 android 项目转换为一个库项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!