25
25
import java .io .IOException ;
26
26
import java .io .InputStream ;
27
27
import java .io .OutputStream ;
28
+ import java .lang .reflect .InvocationTargetException ;
28
29
import java .lang .reflect .Method ;
29
30
import java .net .URL ;
30
31
import java .net .URLConnection ;
@@ -129,6 +130,7 @@ private static boolean loadLibraryAndroid(String libname) {
129
130
return false ;
130
131
}
131
132
133
+ //noinspection TryWithIdenticalCatches
132
134
try {
133
135
Class <?> context = Class .forName ("android.content.Context" );
134
136
if (BoxStore .relinker == null ) {
@@ -141,10 +143,17 @@ private static boolean loadLibraryAndroid(String libname) {
141
143
Method loadLibrary = BoxStore .relinker .getClass ().getMethod ("loadLibrary" , context , String .class , String .class );
142
144
loadLibrary .invoke (BoxStore .relinker , BoxStore .context , libname , BoxStore .JNI_VERSION );
143
145
}
144
- } catch (ReflectiveOperationException e ) {
145
- // note: do not catch Exception as it will swallow ReLinker exceptions useful for debugging
146
+ } catch (NoSuchMethodException e ) {
147
+ return false ;
148
+ } catch (IllegalAccessException e ) {
149
+ return false ;
150
+ } catch (InvocationTargetException e ) {
151
+ return false ;
152
+ } catch (ClassNotFoundException e ) {
146
153
return false ;
147
154
}
155
+ // note: do not catch Exception as it will swallow ReLinker exceptions useful for debugging
156
+ // note: can't catch ReflectiveOperationException, is K+ (19+) on Android
148
157
149
158
return true ;
150
159
}
0 commit comments