1

I'm using the Sina SDK in my project.We must include it's .so libs. But I have no idea how to include it. enter image description here

I put the .so libs in my jniLibs folder. Then I don't know how to write the gradle code to include them.

// Copy *.so files from libs/ folder of your project to native-libs folder
// Adjust if your native libraries are somewhere else..
task copyNativeLibs(type: Copy) {
    from(new File(project(':yourproject').projectDir, 'libs')) { include '**/*.so' }
    into new File(buildDir, 'native-libs')
}

// Whenever the code is compiled, also copy the native libs to the build folder
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }

// On "gradle clean" also reverse the copying of the native libraries
clean.dependsOn 'cleanCopyNativeLibs'

// Include the native-libs folder into the final APK
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniDir new File(buildDir, 'native-libs')
}

I find the code from the network, I don't know how to write it for my project.

Allen Vork
  • 1,536
  • 3
  • 16
  • 29

0 Answers0