@NotNull private static Collection<File> getLibraries(ApkVariant variant) { try { Method methodOnAndroidBefore30 = variant.getClass().getMethod("getCompileLibraries"); return (Set<File>) methodOnAndroidBefore30.invoke(variant, (Object[]) null); } catch (NoSuchMethodException e) { return variant.getCompileClasspath(null).getFiles(); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalArgumentException("Unable to call getCompileLibraries", e); } }
@NotNull private static Collection<File> getLibraries(ApkVariant variant) { try { Method methodOnAndroidBefore30 = variant.getClass().getMethod("getCompileLibraries"); return (Set<File>) methodOnAndroidBefore30.invoke(variant, (Object[]) null); } catch (NoSuchMethodException e) { return variant.getCompileClasspath(null).getFiles(); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalArgumentException("Unable to call getCompileLibraries", e); } }