Brion VIBBER has uploaded a new change for review. https://gerrit.wikimedia.org/r/122545
Change subject: [Gingerbread] Fix explosion on calling static WebView method ...................................................................... [Gingerbread] Fix explosion on calling static WebView method For some reason checking the version isn't enough for a static class method? Use reflection to call the debug setting method. Change-Id: I5d776348379b5e7f719f3661f94ac0e78bbc8a9b --- M wikipedia/src/main/java/org/wikipedia/WikipediaApp.java 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/45/122545/1 diff --git a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java index 83b80a3..c0b4907 100644 --- a/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java +++ b/wikipedia/src/main/java/org/wikipedia/WikipediaApp.java @@ -7,6 +7,7 @@ import android.net.*; import android.os.*; import android.preference.*; +import android.util.Log; import android.webkit.*; import com.squareup.otto.*; import org.acra.*; @@ -21,6 +22,8 @@ import org.wikipedia.pageimages.*; import org.wikipedia.savedpages.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.*; @@ -78,7 +81,21 @@ // Enable debugging on the webview if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - WebView.setWebContentsDebuggingEnabled(true); + // Even though we have a check above, using a static method like this + // kills our class on 2.3 unless we jump through some reflection hoops. + try { + Method setWebContentsDebuggingEnabled = WebView.class.getMethod("setWebContentsDebuggingEnabled", boolean.class); + setWebContentsDebuggingEnabled.invoke(WebView.class, new Object[] {true}); + } catch (NoSuchMethodException e) { + // This shouldn't happen + e.printStackTrace(); + } catch (InvocationTargetException e) { + // This shouldn't happen either + e.printStackTrace(); + } catch (IllegalAccessException e) { + // This shouldn't happen, really I swear + e.printStackTrace(); + } } Api.setConnectionFactory(new OkHttpConnectionFactory(this)); -- To view, visit https://gerrit.wikimedia.org/r/122545 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d776348379b5e7f719f3661f94ac0e78bbc8a9b Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits