简体   繁体   中英

How do I create a library project in android studio?

I've been having some difficulties over the past couple of days and can't seem to get it working. I'm trying to add the zbar library to my project:

https://github.com/dm77/ZBarScanner

Can anyone guide me through the process? Thanks!

The key is to add a dependency from the application project, in the ÷build.gradle÷ file:

dependencies {
    compile files('libs/android-support-v4.jar')
    compile project(':Zbar_Project_Name')
}

And, in the IntelliJ Module file, ??.iml :

<orderEntry type="library" name="android-support-v4" level="application" />
<orderEntry type="library" name="Zbar_Project_Name.aar" level="project" />

In the library project, there's not much to do: tell Gradle and Android Studio that this is an Android library, with apply plugin:

android-library

and

<option name=”LIBRARY_PROJECT” value=”true” />

respectively.

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