Advertisement
Guest User

Untitled

a guest
May 2nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.27 KB | None | 0 0
  1. sourceSets {
  2.         main {
  3.             jniLibs.srcDirs = ['libs']
  4.         }
  5.     }
  6.  
  7. // called every time gradle gets executed, takes the native dependencies of
  8.     // the natives configuration, and extracts them to the proper libs/ folders
  9.     // so they get packed with the APK.
  10.     task copyAndroidNatives() {
  11.         file("libs/armeabi/").mkdirs()
  12.         file("libs/armeabi-v7a/").mkdirs()
  13.         file("libs/arm64-v8a/").mkdirs()
  14.         file("libs/x86_64/").mkdirs()
  15.         file("libs/x86/").mkdirs()
  16.  
  17.         configurations.natives.files.each { jar ->
  18.             def outputDir = null
  19.             if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
  20.             if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
  21.             if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
  22.             if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
  23.             if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
  24.             if (outputDir != null) {
  25.                 copy {
  26.                     from zipTree(jar)
  27.                     into outputDir
  28.                     include "*.so"
  29.                 }
  30.             }
  31.         }
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement