diff --git a/.travis.yml b/.travis.yml index 687670c..2e454b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ android: # Specify at least one system image, # if you need to run emulator(s) during your tests - - sys-img-x86_64-android-19 + - sys-img-x86-android-23 # - sys-img-armeabi-v7a-android-19 # - sys-img-x86-android-17 # TODO: Configure travis to run in more than one emulator @@ -40,7 +40,7 @@ before_install: # Building .AAR, needed for instrumentation tests (they depend on the prebuilt_aar) - ./gradlew build --no-daemon # Emulator Management: Create, Start and Wait - - echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a + - echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & diff --git a/build.gradle b/build.gradle index 966fbcf..d374412 100644 --- a/build.gradle +++ b/build.gradle @@ -70,7 +70,7 @@ if (!project.hasProperty('sonatypeRepo') || apply plugin: 'maven' apply plugin: 'signing' -version = "2.0.2" +version = "2.0.3" group = "com.facebook.conceal" signing { diff --git a/first-party/soloader/SoLoader.java b/first-party/soloader/SoLoader.java index 00c7637..1521e77 100644 --- a/first-party/soloader/SoLoader.java +++ b/first-party/soloader/SoLoader.java @@ -257,21 +257,26 @@ private static synchronized void initSoLoader(@Nullable SoFileLoader soFileLoade sSoFileLoader = new SoFileLoader() { @Override public void load(final String pathToSoFile, final int loadFlags) { + String error = null; if (hasNativeLoadMethod) { final boolean inZip = (loadFlags & SOLOADER_LOOK_IN_ZIP) == SOLOADER_LOOK_IN_ZIP; final String path = inZip ? localLdLibraryPath : localLdLibraryPathNoZips; try { synchronized (runtime) { - String error = (String)nativeLoadRuntimeMethod.invoke( - runtime, - pathToSoFile, - SoLoader.class.getClassLoader(), - path); + error = + // the third argument of nativeLoad method was removed in Android P API + Build.VERSION.SDK_INT <= 27 + ? (String) + nativeLoadRuntimeMethod.invoke( + runtime, pathToSoFile, SoLoader.class.getClassLoader(), path) + : (String) + nativeLoadRuntimeMethod.invoke( + runtime, pathToSoFile, SoLoader.class.getClassLoader()); if (error != null) { throw new UnsatisfiedLinkError(error); } } - } catch (IllegalAccessException + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { final String errMsg = "Error: Cannot load " + pathToSoFile; @@ -292,9 +297,15 @@ private static Method getNativeLoadRuntimeMethod() { } try { - final Method method = - Runtime.class - .getDeclaredMethod("nativeLoad", String.class, ClassLoader.class, String.class); + final Method method; + if (Build.VERSION.SDK_INT <= 27) { + method = + Runtime.class.getDeclaredMethod( + "nativeLoad", String.class, ClassLoader.class, String.class); + } else { + method = Runtime.class.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class); + } + method.setAccessible(true); return method; } catch (final NoSuchMethodException | SecurityException e) {