Add. So files in Android studio

Source: Internet
Author: User

Scene: Android Studio compiled my project (the project has the use of JNI), compile no error, normal installation to my machine, but the operation of the error, did not find the *.so file ...

But clearly in the Libs, the directory has the relevant documents?


Refer to the online majority of practices, the new jnilibs folder to put the relevant files in this file, for example

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/0B/wKioL1TF8WujaUuqAACNyDhGgmg024.jpg "title=" 1.png " alt= "Wkiol1tf8wujauuqaacnydhggmg024.jpg"/>

This is the default condition for the directory structure

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/0B/wKioL1TF8ibTTgKMAAB1PV0V6FY200.jpg "title=" 2.png " alt= "Wkiol1tf8ibttgkmaab1pv0v6fy200.jpg"/>

So it's done.


But my project is the directory structure from Eclipse is not the same as above, as follows:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/0E/wKiom1TF85SB1AwYAADd1OQo8ZE424.jpg "title=" 3.png " alt= "Wkiom1tf85sb1awyaadd1oqo8ze424.jpg"/>

I also joined the jnilibs this directory, package related files to put here, the structure to run to the machine or not, or can not find the *.so file ...


Directory structure I do not want to change, and then I look at the Build.gradle file has sourcesets this setting, the attempt to add parameters here, sure enough to run the normal 650) this.width=650; "src="/http Img.baidu.com/hi/jx2/j_0005.gif "alt=" J_0005.gif "/>

Code:

    sourceSets {        main {             manifest.srcFile  ' Androidmanifest.xml '             java.srcdirs = [' src ']             resources.srcdirs = [' src ']             aidl.srcdirs = [' src ']             renderscript.srcdirs = [' src ']             res.srcdirs = [' Res ']             assets.srcdirs = [' Assets ']             //  The key is this sentence               jnilibs.srcdirs = [' Jnilibs ']        }         debug.setroot (' Build-types/debug ')          release.setroot (' build-types/release ')     }


This article from "yards Nong to turn over" blog, please be sure to keep this source http://xiaodongdong.blog.51cto.com/7049299/1608495

Add. So files in Android studio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.