From cc540bac436d7958856edf1bb7d55d2c1aa9f9ae Mon Sep 17 00:00:00 2001 From: Mohammed Nafees Date: Sat, 20 Dec 2014 19:46:13 +0530 Subject: [PATCH] Fix crash due to UnsatisfiedLinkError on all devices. --- mifosng-android/build.gradle | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/mifosng-android/build.gradle b/mifosng-android/build.gradle index ce32e0641d7..99552ba35b7 100644 --- a/mifosng-android/build.gradle +++ b/mifosng-android/build.gradle @@ -72,26 +72,31 @@ android { } } -task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') { - destinationDir file("$buildDir/native-libs") - baseName 'native-libs' - extension 'jar' - from fileTree(dir: 'src/main/libs', include: '**/*.so') - into 'lib/' -} - task buildAndEMailAPK(type: Exec, description: 'Builds and Generates a Signed APK and emails it'){ } +task copyNativeLibs(type: Copy) { + from(new File(getProjectDir(), 'src/main/libs')) { include '**/*.so' } + into new File(buildDir, 'native-libs') +} + tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn(nativeLibsToJar) + compileTask -> + compileTask.dependsOn(copyNativeLibs) +} + +clean.dependsOn('cleanCopyNativeLibs') + +tasks.withType(com.android.build.gradle.tasks.PackageApplication) { + pkgTask -> + pkgTask.jniFolders = new HashSet() + pkgTask.jniFolders.add(new File(buildDir, 'native-libs')) } dependencies { compile fileTree(dir: 'src/main/libs', include: ['*.jar']) - compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') // You must install or update the Support Repository through the SDK manager to use this dependency. // You must install or update the Google Repository through the SDK manager to use this dependency.