How can I get webview console log through adb?How to define and use a system property in Android Instrumentation test?Debugging WebView in React Native appsDebugging a WebView (Ionic) app on Android via logcatFling gesture detection on grid layoutWhy is the Android emulator so slow? How can we speed up the Android emulator?Android error: Failed to install *.apk on device *: timeoutHow can I access my localhost from my Android device?Install an apk file from command prompt?Android Studio: Add jar as library?Dilemma: when to use Fragments vs Activities:Android Studio - no debuggable applicationsThe APK file does not exist on diskHow to dump indexeddb from webview in release Android apk

Who is "He that flies" in Lord of the Rings?

If the pressure inside and outside a balloon balance, then why does air leave when it pops?

Professor Roman loves to teach unorthodox Chemistry

Placement of positioning lights on A320 winglets

Grandpa has another non math question

What is Gilligan's full Name?

Why do (or did, until very recently) aircraft transponders wait to be interrogated before broadcasting beacon signals?

As easy as Three, Two, One... How fast can you go from Five to Four?

If absolute velocity does not exist, how can we say a rocket accelerates in empty space?

Mathematica 12 has gotten worse at solving simple equations?

Can I use 220 V outlets on a 15 ampere breaker and wire it up as 110 V?

Why is my power MOSFET heating up when on?

What does the homotopy coherent nerve do to spaces of enriched functors?

How many sets of dice do I need for D&D?

Do Veracrypt encrypted volumes have any kind of brute force protection?

What class is best to play when a level behind the rest of the party?

What does "lit." mean in boiling point or melting point specification?

How to make a composition of functions prettier?

Why did the World Bank set the global poverty line at $1.90?

Do SFDX commands count toward limits?

Part of my house is inexplicably gone

How to befriend someone who doesn't like to talk?

Are regulatory compliance checks performed within the EU bloc?

How can you estimate a spike story?



How can I get webview console log through adb?


How to define and use a system property in Android Instrumentation test?Debugging WebView in React Native appsDebugging a WebView (Ionic) app on Android via logcatFling gesture detection on grid layoutWhy is the Android emulator so slow? How can we speed up the Android emulator?Android error: Failed to install *.apk on device *: timeoutHow can I access my localhost from my Android device?Install an apk file from command prompt?Android Studio: Add jar as library?Dilemma: when to use Fragments vs Activities:Android Studio - no debuggable applicationsThe APK file does not exist on diskHow to dump indexeddb from webview in release Android apk






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am building an Android application with Cordova which is running inside a webview. I know I can access the webview via chrome://inspect but it only works for debug build. It can't inspect the chrome in release APK. So is there a way to get the chrome console log via adb command?










share|improve this question
























  • Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

    – Morrison Chang
    Mar 24 at 23:11












  • I am using Cordova and I have updated the question. Thanks.

    – Zhao Yi
    Mar 24 at 23:16











  • This question/answers may help Debugging WebView in apps

    – Jon Goodwin
    Mar 25 at 0:52

















0















I am building an Android application with Cordova which is running inside a webview. I know I can access the webview via chrome://inspect but it only works for debug build. It can't inspect the chrome in release APK. So is there a way to get the chrome console log via adb command?










share|improve this question
























  • Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

    – Morrison Chang
    Mar 24 at 23:11












  • I am using Cordova and I have updated the question. Thanks.

    – Zhao Yi
    Mar 24 at 23:16











  • This question/answers may help Debugging WebView in apps

    – Jon Goodwin
    Mar 25 at 0:52













0












0








0








I am building an Android application with Cordova which is running inside a webview. I know I can access the webview via chrome://inspect but it only works for debug build. It can't inspect the chrome in release APK. So is there a way to get the chrome console log via adb command?










share|improve this question
















I am building an Android application with Cordova which is running inside a webview. I know I can access the webview via chrome://inspect but it only works for debug build. It can't inspect the chrome in release APK. So is there a way to get the chrome console log via adb command?







android google-chrome webview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 23:16







Zhao Yi

















asked Mar 24 at 22:57









Zhao YiZhao Yi

6,1341964144




6,1341964144












  • Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

    – Morrison Chang
    Mar 24 at 23:11












  • I am using Cordova and I have updated the question. Thanks.

    – Zhao Yi
    Mar 24 at 23:16











  • This question/answers may help Debugging WebView in apps

    – Jon Goodwin
    Mar 25 at 0:52

















  • Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

    – Morrison Chang
    Mar 24 at 23:11












  • I am using Cordova and I have updated the question. Thanks.

    – Zhao Yi
    Mar 24 at 23:16











  • This question/answers may help Debugging WebView in apps

    – Jon Goodwin
    Mar 25 at 0:52
















Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

– Morrison Chang
Mar 24 at 23:11






Are you using a particular framework or tool to build your app or are you just putting HTML5/Javascript into a simple native (Java/Kotlin) Android app wrapping a WebView?

– Morrison Chang
Mar 24 at 23:11














I am using Cordova and I have updated the question. Thanks.

– Zhao Yi
Mar 24 at 23:16





I am using Cordova and I have updated the question. Thanks.

– Zhao Yi
Mar 24 at 23:16













This question/answers may help Debugging WebView in apps

– Jon Goodwin
Mar 25 at 0:52





This question/answers may help Debugging WebView in apps

– Jon Goodwin
Mar 25 at 0:52












2 Answers
2






active

oldest

votes


















0














For getting the console log via adb see: Debugging a WebView (Ionic) app on Android via logcat



Try the above first as I seem to misread your question about debugging a WebView via remote debugging, which is what follows.



For a simple native Java/Kotlin Android app wrapping a WebView, the documentation is quite clear that all one needs to do is to enable the feature:



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
WebView.setWebContentsDebuggingEnabled(true);



and additional code is required to limit it to debug version:



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
WebView.setWebContentsDebuggingEnabled(true);



Looking at what is in the Cordova Android repo:



Cordova Android - ... SystemWebViewEngine.java



the relevant code is here:



//Determine whether we're in debug or release mode, and turn on Debugging!
ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
enableRemoteDebugging();



I also found this open ISSUE 500: Release version still have debugging enabled which implies that Android Emulators are allow for debugging even though the APK is packaged for release.



So my suggestions for remote debugging a WebView on a release APK are:



  1. Try to use the emulator for debugging with a release APK as it appears to be possible.


  2. Consider forking the Cordova Android code and create a special debug mode so that on device it would be possible to debug the contents of a WebView. Enabling such a feature could be hidden via a custom system property: How to define and use a system property in Android? For example say you defined the flag to be named com.example.myapp.debugwebview. You could set the property via command like adb setprop com.example.myapp.debugwebview 1 and on start/restart the app would enable WebView debugging. Note that this does require a more detailed understanding of Android to support such a feature, as well as the effort of supporting a fork.






share|improve this answer
































    0














    Couldn't find this anywhere on SO, here's what worked for me:



    adb -d logcat chromium:I *:S


    The -d indicating a physical device in my case. If all else fails just dump the results of adb logcat into a text file and do a search for "CONSOLE", that will give you the provider for your logcat filter. It seems this changes over time, and depending on your particular dev environment.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329380%2fhow-can-i-get-webview-console-log-through-adb%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      For getting the console log via adb see: Debugging a WebView (Ionic) app on Android via logcat



      Try the above first as I seem to misread your question about debugging a WebView via remote debugging, which is what follows.



      For a simple native Java/Kotlin Android app wrapping a WebView, the documentation is quite clear that all one needs to do is to enable the feature:



      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
      WebView.setWebContentsDebuggingEnabled(true);



      and additional code is required to limit it to debug version:



      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
      if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
      WebView.setWebContentsDebuggingEnabled(true);



      Looking at what is in the Cordova Android repo:



      Cordova Android - ... SystemWebViewEngine.java



      the relevant code is here:



      //Determine whether we're in debug or release mode, and turn on Debugging!
      ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
      if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
      enableRemoteDebugging();



      I also found this open ISSUE 500: Release version still have debugging enabled which implies that Android Emulators are allow for debugging even though the APK is packaged for release.



      So my suggestions for remote debugging a WebView on a release APK are:



      1. Try to use the emulator for debugging with a release APK as it appears to be possible.


      2. Consider forking the Cordova Android code and create a special debug mode so that on device it would be possible to debug the contents of a WebView. Enabling such a feature could be hidden via a custom system property: How to define and use a system property in Android? For example say you defined the flag to be named com.example.myapp.debugwebview. You could set the property via command like adb setprop com.example.myapp.debugwebview 1 and on start/restart the app would enable WebView debugging. Note that this does require a more detailed understanding of Android to support such a feature, as well as the effort of supporting a fork.






      share|improve this answer





























        0














        For getting the console log via adb see: Debugging a WebView (Ionic) app on Android via logcat



        Try the above first as I seem to misread your question about debugging a WebView via remote debugging, which is what follows.



        For a simple native Java/Kotlin Android app wrapping a WebView, the documentation is quite clear that all one needs to do is to enable the feature:



        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
        WebView.setWebContentsDebuggingEnabled(true);



        and additional code is required to limit it to debug version:



        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
        if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
        WebView.setWebContentsDebuggingEnabled(true);



        Looking at what is in the Cordova Android repo:



        Cordova Android - ... SystemWebViewEngine.java



        the relevant code is here:



        //Determine whether we're in debug or release mode, and turn on Debugging!
        ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
        enableRemoteDebugging();



        I also found this open ISSUE 500: Release version still have debugging enabled which implies that Android Emulators are allow for debugging even though the APK is packaged for release.



        So my suggestions for remote debugging a WebView on a release APK are:



        1. Try to use the emulator for debugging with a release APK as it appears to be possible.


        2. Consider forking the Cordova Android code and create a special debug mode so that on device it would be possible to debug the contents of a WebView. Enabling such a feature could be hidden via a custom system property: How to define and use a system property in Android? For example say you defined the flag to be named com.example.myapp.debugwebview. You could set the property via command like adb setprop com.example.myapp.debugwebview 1 and on start/restart the app would enable WebView debugging. Note that this does require a more detailed understanding of Android to support such a feature, as well as the effort of supporting a fork.






        share|improve this answer



























          0












          0








          0







          For getting the console log via adb see: Debugging a WebView (Ionic) app on Android via logcat



          Try the above first as I seem to misread your question about debugging a WebView via remote debugging, which is what follows.



          For a simple native Java/Kotlin Android app wrapping a WebView, the documentation is quite clear that all one needs to do is to enable the feature:



          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
          WebView.setWebContentsDebuggingEnabled(true);



          and additional code is required to limit it to debug version:



          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
          if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
          WebView.setWebContentsDebuggingEnabled(true);



          Looking at what is in the Cordova Android repo:



          Cordova Android - ... SystemWebViewEngine.java



          the relevant code is here:



          //Determine whether we're in debug or release mode, and turn on Debugging!
          ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
          if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
          enableRemoteDebugging();



          I also found this open ISSUE 500: Release version still have debugging enabled which implies that Android Emulators are allow for debugging even though the APK is packaged for release.



          So my suggestions for remote debugging a WebView on a release APK are:



          1. Try to use the emulator for debugging with a release APK as it appears to be possible.


          2. Consider forking the Cordova Android code and create a special debug mode so that on device it would be possible to debug the contents of a WebView. Enabling such a feature could be hidden via a custom system property: How to define and use a system property in Android? For example say you defined the flag to be named com.example.myapp.debugwebview. You could set the property via command like adb setprop com.example.myapp.debugwebview 1 and on start/restart the app would enable WebView debugging. Note that this does require a more detailed understanding of Android to support such a feature, as well as the effort of supporting a fork.






          share|improve this answer















          For getting the console log via adb see: Debugging a WebView (Ionic) app on Android via logcat



          Try the above first as I seem to misread your question about debugging a WebView via remote debugging, which is what follows.



          For a simple native Java/Kotlin Android app wrapping a WebView, the documentation is quite clear that all one needs to do is to enable the feature:



          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
          WebView.setWebContentsDebuggingEnabled(true);



          and additional code is required to limit it to debug version:



          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 
          if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
          WebView.setWebContentsDebuggingEnabled(true);



          Looking at what is in the Cordova Android repo:



          Cordova Android - ... SystemWebViewEngine.java



          the relevant code is here:



          //Determine whether we're in debug or release mode, and turn on Debugging!
          ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
          if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0)
          enableRemoteDebugging();



          I also found this open ISSUE 500: Release version still have debugging enabled which implies that Android Emulators are allow for debugging even though the APK is packaged for release.



          So my suggestions for remote debugging a WebView on a release APK are:



          1. Try to use the emulator for debugging with a release APK as it appears to be possible.


          2. Consider forking the Cordova Android code and create a special debug mode so that on device it would be possible to debug the contents of a WebView. Enabling such a feature could be hidden via a custom system property: How to define and use a system property in Android? For example say you defined the flag to be named com.example.myapp.debugwebview. You could set the property via command like adb setprop com.example.myapp.debugwebview 1 and on start/restart the app would enable WebView debugging. Note that this does require a more detailed understanding of Android to support such a feature, as well as the effort of supporting a fork.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 0:12

























          answered Mar 25 at 0:04









          Morrison ChangMorrison Chang

          8,41932650




          8,41932650























              0














              Couldn't find this anywhere on SO, here's what worked for me:



              adb -d logcat chromium:I *:S


              The -d indicating a physical device in my case. If all else fails just dump the results of adb logcat into a text file and do a search for "CONSOLE", that will give you the provider for your logcat filter. It seems this changes over time, and depending on your particular dev environment.






              share|improve this answer



























                0














                Couldn't find this anywhere on SO, here's what worked for me:



                adb -d logcat chromium:I *:S


                The -d indicating a physical device in my case. If all else fails just dump the results of adb logcat into a text file and do a search for "CONSOLE", that will give you the provider for your logcat filter. It seems this changes over time, and depending on your particular dev environment.






                share|improve this answer

























                  0












                  0








                  0







                  Couldn't find this anywhere on SO, here's what worked for me:



                  adb -d logcat chromium:I *:S


                  The -d indicating a physical device in my case. If all else fails just dump the results of adb logcat into a text file and do a search for "CONSOLE", that will give you the provider for your logcat filter. It seems this changes over time, and depending on your particular dev environment.






                  share|improve this answer













                  Couldn't find this anywhere on SO, here's what worked for me:



                  adb -d logcat chromium:I *:S


                  The -d indicating a physical device in my case. If all else fails just dump the results of adb logcat into a text file and do a search for "CONSOLE", that will give you the provider for your logcat filter. It seems this changes over time, and depending on your particular dev environment.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 15 at 23:38









                  Ben BrianBen Brian

                  13016




                  13016



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329380%2fhow-can-i-get-webview-console-log-through-adb%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript