码迷,mamicode.com
首页 > 移动开发 > 详细

Android Studio 为工程添加.so库

时间:2015-12-31 12:46:58      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:

1.把文件copy到libs下。

2.在app/build.gradle文件的android层级下添加。

sourceSets.main {
jniLibs.srcDir ‘libs‘
}

问答链接 http://stackoverflow.com/questions/24357687/how-to-include-so-library-in-android-studio/28430334#28430334

Solution 1 : Creation of a JniLibs folder

Create a folder called “jniLibs” into your app and the folders containing your *.so inside. The "jniLibs" folder needs to be created in the same folder as your "Java" or "Assets" folders.

Solution 2 : Modification of the build.gradle file

If you don’t want to create a new folder and keep your *.so files into the libs folder, it is possible !

In that case, just add your *.so files into the libs folder (please respect the same architecture as the solution 1 : libs/armeabi/.so for instance) and modify the build.gradle file of your app to add the source directory of the jniLibs.

sourceSets {
        main {
             jni.srcDirs = ["libs"]
             }
           }

You will have more explanations, with screenshots to help you here ( Step 6 ):

http://blog.guillaumeagis.eu/setup-andengine-with-android-studio/

Android Studio 为工程添加.so库

标签:

原文地址:http://www.cnblogs.com/StuLiuJun/p/5091279.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!