如何更改摇篮libs目录? [英] How to change libs directory in Gradle?
问题描述
我想Zbar融入我的应用程序,但不能似乎找出如何使用新的Android Studio来做到这一点。
I want to integrate Zbar into my application but cant seem to figure out how to accomplish this using the new Android Studio.
我已经通过实例看,并复制了code没有任何问题。我遇到的问题是,添加库到我的项目,我似乎无法弄清楚如何做到这一点。可能有人走我走过的呢?
I have looked through the example and have copied over the code without any issues. The problem I am having is adding the libs to my project I cant seem to figure out how to do it. Could someone walk me through it?
推荐答案
其实,@迈克尔的答案是正确的,它也是过时。现在,使用摇篮所有你需要做的是在build.gradle文件中添加以下行:
Actually, @Michael's answer is correct, it is also obsolete. Now, using gradle all you need to do is to add the lines below in the build.gradle file:
android {
...
sourceSets {
main.jniLibs.srcDirs = ['libs']
test.jniLibs.srcDirs = ['libs']
}
}
或者直接把你的.so库入:
or directly put your .so libraries into:
钢骨混凝土/主/ jniLibs
src/main/jniLibs
这样,当你建立你的应用程序或库中,JNI库被复制到目标的.jar / .aar文件。
This way, when you build your application or library, the jni libraries are being copied into destination .jar/.aar file.
这篇关于如何更改摇篮libs目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!