Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Ask, and ye shall receive.
cavalcantejean
Posts: 1
Joined: 15:36, 15 Jul 2015

Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby cavalcantejean » 16:14, 15 Jul 2015

Hello everyone,
I am new to evothings but I used the BLE Scan example to make an android app with cordova to activate the bluetooth and list the active devices. But when I click on "Start Scan". It shows me the following message in the android logcat on Eclipse:
Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby Fredrik » 15:13, 21 Jul 2015

I suspect that the BLE plugin is missing. Add it by running this command:

cordova plugin add https://github.com/evothings/cordova-ble

abstractUser
Posts: 1
Joined: 08:26, 19 Sep 2015

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby abstractUser » 08:37, 19 Sep 2015

Hello:

I'm encountering a similar problem. I've installed the ble plugin.

To summarize the problem.
1. The app runs perfectly well when run from the Evothings client app.
2. The cordova built app works otherwise fine but for the functionality when a bluetooth connection is requested.
3. When a connection is requested, evothings.rfduinoble.close() is called, which in turn calls evothings.easyble.stopScan(), which in turn calls evothings.ble.stopScan().
4. Where is this last function i.e, evothings.ble.stopScan(), as the error occurs at this stage.
5. ble.js that comes with the plugin does not have the definition of this function.

So perhaps, we are missing something.

Thank you.

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby Fredrik » 12:53, 22 Sep 2015

ble.js contains "exports.stopScan". The "exports" part gets converted by cordova to "evothings.ble".

Let's check if you added the plugin properly. Run "dir plugins" (or "ls plugins" on mac/linux) and post the output.

josephclawrence
Posts: 7
Joined: 12:49, 19 Nov 2015

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby josephclawrence » 14:11, 19 Nov 2015

I think I'm having exactly the same issue on iOS, covered in a new thread here, if anyone comes here (not solved yet): viewtopic.php?f=8&t=1847

I'm pretty sure the plugin is installed correctly. If I ls plugins I have fetch.json, ios.json and cordova-plugin-ble, as well as cordova-plugin-whitelist. The plugin is also then present in some form in /platforms/ios/www and /platforms/ios/platform_www

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Postby micke » 22:42, 29 Dec 2015

@josephclawrence

One thing to try is building the Evothings Viewer app and see if that works. Build instructions are provided here:

https://github.com/evothings/evothings-viewer

Evothings Viewer is easier to build than Evothings Client (and works with Evothings 2.0). The build depends only on Cordova.

Modify the list of plugins in this file:

https://github.com/evothings/evothings- ... ckage.json

You can for example remove plugins you do not need, and add ones not included.

Let me know ho it goes!

Best, Mikael


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 6 guests