Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Found an issue in SpiderBasic ? Please report it here !
hoerbie
Posts: 45
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by hoerbie »

Hi,
since some days I get the error:

Code: Select all

Fetching plugin "cordova-plugin-device" via npm
Installing "cordova-plugin-device" for android
Error: code: engine.platform or engine.scriptSrc is not defined in
custom engine "cordova-electron" from plugin
"cordova-plugin-device" for android warn
when compiling an app for Android.
With commenting out every DeviceInfo(*) call, I can compile an Android app, but then I don't get any information of the running system, the systems uuid etc. Some information I can get from the "browser" agent text using platform.* in javascript, but not all I need.
It looks, like there is a new version 2.1.0 of cordova-plugin-device from 6 days ago, after 3 years of version 2.0.3.
Any help or idea? Can I force cordova to use older plugin?
Regards, hoerbie
temisnet
Posts: 8
Joined: Fri Jan 14, 2022 1:24 pm

Re: Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by temisnet »

I'm having the same problem, does anyone have a solution?
hoerbie
Posts: 45
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Re: Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by hoerbie »

Hi,

with some testing I found a workaround, until the DeviceInfo() function will maybe fixed by Fred in some years. ;) :cry:
When i comment out every use of DeviceInfo(), import an older version of the cordova-device-plugin and use my own functions, I can compile:

Code: Select all

Import "cordova plugin add cordova-plugin-device@2.0.1" : EndImport

Procedure.s GetCordova()
  ! return device.cordova
EndProcedure
Procedure.s GetVersion()
  ! return device.version
EndProcedure
Procedure.s GetManufacturer()
  ! return device.manufacturer
EndProcedure
Procedure.s GetModel()
  ! return device.model
EndProcedure
Procedure.s GetPlatform()
  ! return device.platform
EndProcedure
Procedure.s GetSerial()
  ! return device.serial
EndProcedure
Procedure.s GetUUID()
  ! return device.uuid
EndProcedure

Debug "Cordova: "+GetCordova()
Debug "Version: "+GetVersion()
Debug "Manufacturer: "+GetManufacturer()
Debug "Model: "+GetManufacturer()
Debug "Platform: "+GetPlatform()
Debug "Serial: "+GetSerial()
Debug "UUID: "+GetUUID()
A better way would be using a Macro and overwriting the DeviceInfo() with one own function, but for me it's too late now....

Greets from hoerbie
temisnet
Posts: 8
Joined: Fri Jan 14, 2022 1:24 pm

Re: Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by temisnet »

I commented DeviceInfo() but the error continues, do you know what other command may be using cordova?
hoerbie
Posts: 45
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Re: Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by hoerbie »

DeviceAlwaysOn() also made the compile of another app stop with the same error.

And I don't use the following, but from my instinct have a look at other system near functions like DeviceBrightness() or VibrateDevice() or BatteryLevel(), or functions that use different cordova plugins like Accelerometer, Geolocation, In-App Purchase.
temisnet
Posts: 8
Joined: Fri Jan 14, 2022 1:24 pm

Re: Android compile error - DeviceInfo(*) and new cordova-plugin-device?

Post by temisnet »

Any solution, does anyone believe this Cordova update will resolve itself soon?
Post Reply