Android and android Official Website

Source: Internet
Author: User

Android and android Official Website
". So" library used in Gradle Architecture


Address: http://blog.csdn.net/caroline_wendy


AndroidGradle ArchitectureAndroid Application, you need. So LibraryFor special processing, compilation is correct and usage is incorrect because it cannot be found. The common usage is that different CPUs have different libraries, including:Armeabi, mips, x86.
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 solutions: 1. Generate the ". so" library and introduce the jar into the project. Pay attention to the directory sequence:
-lib--armeabi---xxx.so
Command:
jar cvf xxx_cpu.jar ./lib
Load it to the application;
2. Use gradle to configure Android {}To 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'))    }

You can ," // Noinspection all"Can be removed Warning.

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.