couldn't find "libweibosdkcore.so"

按照官网给出来的例子,通过添加依赖的方式,实现微博的分享功能。测试很多台机子很少见出现问题,不过在华为(TAG-CL00)手机上就直接奔溃了,出现下面的错误日志,说找不到libweibosdkcore.so包


java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.xf.activity-1/base.apk”],nativeLibraryDirectories=[/data/app/com.xf.activity-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn’t find “libweibosdkcore.so”
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:988)
at com.sina.weibo.sdk.net.HttpManager.(HttpManager.java:43)
at com.sina.weibo.sdk.utils.AidTask.loadAidFromNet(AidTask.java:400)
at com.sina.weibo.sdk.utils.AidTask.access 200(AidTask.java:49)atcom.sina.weibo.sdk.utils.AidTask 2.run(AidTask.java:232)
at java.lang.Thread.run(Thread.java:818)


解决办法:

  • 1,在jniLibs包下面创建下面几个包并且加入在微博官网下载demo的libweibosdkcore.so文件
    arm64-v8a
    armeabi
    armeabi-v7a
    mips
    mips64
    x86
    x86_64
    couldn't find

  • 2,在项目的gradle添加好相应的依赖

android下添加:
    // 将 .so 文件打包为 Native_Libs.jar 包文件
    task nativeLibsToJar(type: Zip, description: "create a jar archive of the native libs") {
        destinationDir file("$projectDir/libs")
        baseName "Native_Libs"
        extension "jar"
        from fileTree(dir: "libs", include: "**/*.so")
        into "lib"
    }
    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn(nativeLibsToJar)
    }//////////

再在dependencies中添加依赖:
    //新浪
    compile 'com.sina.weibo.sdk:core:2.0.3:openDefaultRelease@aar'
    compile files('libs/Native_Libs.jar') // 加载上方 .so 生成的该文件

couldn't find

这里写图片描述

  • 3,再在项目的gradle中添加下面代码
    jcenter()
    mavenCentral()
    maven { url "https://dl.bintray.com/thelasterstar/maven/" }

couldn't find

到这里时,问题已经解决了。

你可能感兴趣的:(安卓开发,微博分享,找不so,分享)