The ". So" library used in the Android-gradle schema

Source: Internet
Author: User

The ". So" library used in the Gradle schema


This address: Http://blog.csdn.net/caroline_wendy


Android uses the gradle architecture of Android applications, need to do special processing of . So library , because will not find, will lead to compile correct, use error; common usage is based on different CPUs, There are different libraries, including:armeabi,mips,x86 and so on.
Error:

Java.lang.UnsatisfiedLinkError:Couldn ' t load weibosdkcore from loader dalvik.system.pathclassloader[dexpathlist[[ Zip file "/data/app/xxx.apk"],nativelibrarydirectories=[/data/app-lib/xxx-2,/vendor/lib,/system/lib]]: Findlibrary returned null

There are two ways to solve this:1. Generate a jar for the ". So" libraryTo bring the jar into the project, you need to note the order of the directories:
-lib--armeabi---xxx.so
command:
Jar CVF Xxx_cpu.jar./lib
then load into the application, you can;
2. Using Gradle configurationWithin the scope of android{} , add:
    Noinspection All    task Copynativelibs (type:copy) {        //third party lib        so from (new File (ProjectDir, ' Libs ') {include ' armeabi/*.so '} into        new File (BuildDir, ' native-libs ')    }    Tasks.withtype (javacompile) {        Compiletask-            //noinspection all            compiletask.dependson copynativelibs    }    //noinspection All    Tasks.withtype (com.android.build.gradle.tasks.PackageApplication) {        Pkgtask            - Pkgtask.jnifolders = new hashset<file> ()            PkgTask.jniFolders.add (New File (BuildDir, ' native-libs '))    }

Yes , " //noinspection All" can remove warning.

The ". So" library used in the Android-gradle schema

Related Article

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.