question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Cannot read property 'call' of undefined, not custom plugin related.

See original GitHub issue

Description of the problem:

Affected platform

  • Android 5.0.2
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information: Run on emulator, the same app run on Android 6+ works fine.

Capacitor version: 1.1.1

node version: 8.13.0

npm version: 6.4.1

Steps to reproduce: Create a project for android, run it on the Android 5.0 (device or emulator), use the addListener on App plugin Inspect the WebView and notice the error in console: Uncaught TypeError: Cannot read property 'call' of undefined

Try to call following from the dev tools console: Capacitor.Plugins.App.addListener('appStateChange', function handler() {console.log("App State Changed");}) You will notice the TypeError: Cannot read property 'call' of undefined error. debug and it will point to the

    } catch (e) {
      orgConsole.error.call(win.console, e); // this line
    }

further debug will show that orgConsole is empty! and was attemptet to populate with a line starting Object.keys(win.console)

Attempt to console log the Object.keys(window.console) will show taht only memory key is lsited (where is log, error?) It seems that on the WebView available for Android 5.0 the console is not iterable.

The same call on the dev tools on the Android 6+ lists all of available console methods. (e.g. Android 8 - 24 items listed)

Possible solution could be to create a static list of console props

const consoleLevels = [    
    'debug',
    'error',
    'info',
    'log',
    'trace',
    'warn',
    // anything else needed
];
// then
consoleLevels.forEach(function(level){
   // rest of the code
});

Link to sample project: N\A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bashercommented, Aug 28, 2019

Hi @jcesarmobile - any idea when next release of capacitor-android will be?

We need to run our app on a Clover Flex device, which runs Android 5.1.

1reaction
jcesarmobilecommented, Aug 9, 2019

next release of capacitor-android won’t have this console overwrite, so won’t be a problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'call' of undefined ...
One of the solution was to use concatenateModules: false apparently, but to no avail, it didn't solve my issue. So I tried with...
Read more >
Uncaught TypeError: Cannot read property 'call' of undefined
I'm having an issue with webpack where if I stop watching and restart, it will build just fine, but if I edit a...
Read more >
Uncaught TypeError: Cannot read property 'call' of ... - Laracasts
You need to show us your code that is causing the error. It's pointing to my vue component, I excluded it from app....
Read more >
Uncaught TypeError: Cannot read properties of undefined ...
This issue appears and disapears: first load problem, refresh all works, third load issue, refresh all works..and so on. nonchiedercilaparola.
Read more >
wp.media Uncaught TypeError: Cannot read properties of ...
The this in your select callback is not the same this outside that callback.. So basically, try adding const that = this; right...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found