简体   繁体   中英

Import module or project as Library on Android Studio

I want to use HoloEverywhere (HE) Preferences AddOn with my live wallpaper project. The project is almost done, i just need it to look the same from android 2.3 to 4.4, so i went on and followed the guide to get HE from GitHub.

After the checkout and the successful test of the "Demo" module, i went back to my project, but i can only create a new module, not import one, and of i try to set the new project to the module's folder (library and addons in my case) Android Studio as me if i want to rewrite the module settings, if i do, it create the folder, but it will not compile and the import org.holoeverywhere will not work.

You can set external module in this way

In global setting.gradle file add this line

def projectDialogsDir = file('path_of_the_module')
def rootProjectDescriptor = settings.rootProject
settings.createProjectDescriptor(rootProjectDescriptor, 'yourModule', projectDialogsDir)
include(':yourModule')

Then in the build.gradle files of your app's module, you have just to add, under dependencies

dependencies {
  compile project(':yourModule')
}

There isn't an import module command yet; you'll have to do it manually. The high-level overview is that you'll need to set up a build.gradle file for your library module, include the library module in your project's settings.gradle file, and add a dependency from your app to the library project (which you can do by hand or through the Project Structure UI).

To set up the library module and include it, you can either author the relevant changes from scratch, or you can go through the UI to create a blank module, and then copy the files from the library into the template. UI创建空白模块,然后将文件从库中复制到模板中。 If you want instructions on how to do the latter to include the Facebook library, see this: using facebook sdk in android studio and modify as necessary for holoeverywhere.

导入模块在Android Studio 0.5.5中正常运行

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM