From a7ef04881b9736bf1101158bb7954b4bfa47be5b Mon Sep 17 00:00:00 2001 From: Samuele Perricone Date: Fri, 27 Apr 2018 14:51:38 +0200 Subject: [PATCH] Added gradle configuration tu enable APK split by abi to avoid java.lang.UnsatisfiedLinkError --- app/build.gradle | 28 +++++++++++++++++++ .../com/empatica/sample/MainActivity.java | 6 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5f1d05c..5616561 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,6 +24,34 @@ android { } } +//// DE-COMMENT THIS IF YOU HAVE ISSUES AT RUNTIME, CRASHING WITH java.lang.UnsatisfiedLinkError + +//android { +// +// splits { +// +// // Configures multiple APKs based on ABI. +// abi { +// +// // Enables building multiple APKs per ABI. +// enable true +// +// // By default all ABIs are included, so use reset() and include to specify that we only +// // want APKs for x86, armeabi-v7a, and mips. +// +// // Resets the list of ABIs that Gradle should create APKs for to none. +// reset() +// +// // Specifies a list of ABIs that Gradle should create APKs for. +// include 'armeabi-v7a', 'x86', 'x86_64' // de-comment this to test on emulator +// // include 'armeabi-v7a' +// +// // Specifies that we do not want to also generate a universal APK that includes all ABIs. +// universalApk false +// } +// } +//} + dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' diff --git a/app/src/main/java/com/empatica/sample/MainActivity.java b/app/src/main/java/com/empatica/sample/MainActivity.java index 0e51986..7604463 100644 --- a/app/src/main/java/com/empatica/sample/MainActivity.java +++ b/app/src/main/java/com/empatica/sample/MainActivity.java @@ -163,8 +163,6 @@ private void initEmpaticaDeviceManager() { if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION }, REQUEST_PERMISSION_ACCESS_COARSE_LOCATION); } else { - // Create a new EmpaDeviceManager. MainActivity is both its data and status delegate. - deviceManager = new EmpaDeviceManager(getApplicationContext(), this, this); if (TextUtils.isEmpty(EMPATICA_API_KEY)) { new AlertDialog.Builder(this) @@ -179,6 +177,10 @@ public void onClick(DialogInterface dialog, int which) { .show(); return; } + + // Create a new EmpaDeviceManager. MainActivity is both its data and status delegate. + deviceManager = new EmpaDeviceManager(getApplicationContext(), this, this); + // Initialize the Device Manager using your API key. You need to have Internet access at this point. deviceManager.authenticateWithAPIKey(EMPATICA_API_KEY); }