diff --git a/android/app/build.gradle b/android/app/build.gradle index e9728cfcc..a628b9ccf 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -18,6 +18,7 @@ android { //abiFilters "x86", "armeabi-v7a", "armeabi" abiFilters "armeabi-v7a" } + debuggable true } release { ndk { diff --git a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java index c1eea24cf..bba233af8 100644 --- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java +++ b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java @@ -12,6 +12,7 @@ package org.libreoffice.androidapp; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.res.AssetManager; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; @@ -135,6 +136,14 @@ public class MainActivity extends AppCompatActivity { webSettings.setJavaScriptEnabled(true); mWebView.addJavascriptInterface(this, "LOOLMessageHandler"); + // allow debugging (when building the debug version); see details in + // https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { + WebView.setWebContentsDebuggingEnabled(true); + } + } + mWebView.loadUrl("file:///android_asset/dist/loleaflet.html?file_path=" + urlToLoad + "&closebutton=1&permission=edit" +