简体   繁体   English

如何使用 android 模块作为应用程序和库

[英]How to use an android module as app and library

I have an Android Studio project with an app module.我有一个带有应用程序模块的 Android Studio 项目。
Currently, I am writing another module that should use the first one.目前,我正在编写另一个应该使用第一个模块的模块。
Can I have the first module (which is an app module) be used by the second one as a library?我可以让第一个模块(它是一个应用程序模块)被第二个用作库吗?

you have to do like below你必须像下面那样做

In your 1st app module gradle you have to add your second module implementation.在您的第一个应用模块gradle您必须添加第二个模块实现。

implementation project(':your_second_module_name')

Also you have to update one line in your setting.gradle您还必须在setting.gradle更新一行

include ':app', ':your_second_module_name'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Android Studio中App Engine模块中的Android库模块? - How can I use an Android Library module from App Engine module in Android Studio? 如何在Android库模块中使用振动器 - How to use the Vibrator in an Android Library Module 如何将 Android 模块发布到 GitHub 并将其用作库? - How to publish Android module to GitHub and use it as a library? 如何将项目模块库暴露给 App 模块(Android Studio) - How to expose Project Module Library to App Module (Android Studio) 如何使用android库作为我在项目应用中创建的模块? - How do i use android library as module that i create in my project app? android studio如何使用已在库模块中添加的库依赖项 - android studio how to use library dependencies already added in library module Android:库模块如何使用应用程序模块中定义的类? - Android: How a library module use the class defined in application module? 如何在Android App中使用GitHub上的Library - How to use Library from GitHub in android App 如何使用 Android Jetpack App 启动库 - How to use Android Jetpack App Startup library 在 Android Studio 和 Gradle 中的 Android App Module 中使用不同构建类型的 Library Module - Use different build types of Library Module in Android App Module in Android Studio and Gradle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM