FATAL EXCEPTION: CapacitorPlugins getDeviceId: The uid 10628 does not meet the requirements to access device identifiers

Hi there, I’m in the process of migrating cordova project to capacitor. I’m having the captioned error. Following is my config:
Ionic version: @ionic/angular 7.3.3
Capacitor version: 5.6.0
Android SDK version: 14

capacitor.cmd sync android
[capacitor] √ Copying web assets from www to android\app\src\main\assets\public in 6.15s
[capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 3.93ms
[capacitor] [info] Found 18 Cordova plugins for android:
[capacitor] cordova-plugin-nativeaudio@3.0.9
[capacitor] cordova-plugin-nativeclicksound@0.0.4
[capacitor] cordova-plugin-screen-orientation@3.0.3
[capacitor] cordova-sqlite-storage@4.0.0
[capacitor] es6-promise-plugin@4.2.2
[capacitor] phonegap-plugin-mobile-accessibility@1.0.5
[capacitor] cordova-plugin-advanced-http@3.3.1
[capacitor] cordova-plugin-app-version@0.1.14
[capacitor] cordova-plugin-device@2.1.1-dev
[capacitor] cordova-plugin-file@7.0.0
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.1-dev
[capacitor] cordova-plugin-purchase@13.8.0
[capacitor] cordova-plugin-statusbar@2.4.3
[capacitor] cordova-plugin-uid@1.3.0
[capacitor] cordova-plugin-x-socialsharing@6.0.4
[capacitor] cordova-simple-volume@1.0.4
[capacitor] cordova.plugins.diagnostic@7.1.2
[capacitor] √ copy android in 7.63s
[capacitor] √ Updating Android plugins in 98.33ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor] @capacitor/app@5.0.6
[capacitor] @capacitor/haptics@5.0.6
[capacitor] @capacitor/keyboard@5.0.7
[capacitor] @capacitor/status-bar@5.0.6
[capacitor] [info] Found 18 Cordova plugins for android:
[capacitor] cordova-plugin-nativeaudio@3.0.9
[capacitor] cordova-plugin-nativeclicksound@0.0.4
[capacitor] cordova-plugin-screen-orientation@3.0.3
[capacitor] cordova-sqlite-storage@4.0.0
[capacitor] es6-promise-plugin@4.2.2
[capacitor] phonegap-plugin-mobile-accessibility@1.0.5
[capacitor] cordova-plugin-advanced-http@3.3.1
[capacitor] cordova-plugin-app-version@0.1.14
[capacitor] cordova-plugin-device@2.1.1-dev
[capacitor] cordova-plugin-file@7.0.0
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.1-dev
[capacitor] cordova-plugin-purchase@13.8.0
[capacitor] cordova-plugin-statusbar@2.4.3
[capacitor] cordova-plugin-uid@1.3.0
[capacitor] cordova-plugin-x-socialsharing@6.0.4
[capacitor] cordova-simple-volume@1.0.4
[capacitor] cordova.plugins.diagnostic@7.1.2
[capacitor] [info] Found 4 incompatible Cordova plugins for android, skipped install:
[capacitor] cordova-plugin-add-swift-support@2.0.2
[capacitor] cordova-plugin-ionic-keyboard@2.2.0
[capacitor] cordova-plugin-ionic-webview@5.0.1
[capacitor] cordova-plugin-splashscreen@5.0.4
[capacitor] √ update android in 1.61s
[capacitor] [info] Sync finished in 9.244s

[INFO] Ready for use in your Native IDE!

Note: (1) I didn’t use any of the Capacitor plugin Device nor calling getId() function. Wasn’t so sure why the error always points to the getId(). Following is the error messages:

To native (Cordova plugin): callbackId: NetworkStatus1010139602, service: NetworkStatus, action: getConnectionInfo, actionArgs:
2024-01-16 04:46:11.486 2379-2379 Capacitor/Plugin com.rgtshk.app V To native (Cordova plugin): callbackId: File1010139603, service: File, action: requestAllPaths, actionArgs:
2024-01-16 04:46:11.487 2379-2379 Capacitor/Console com.rgtshk.app I File: https://localhost/ - Line 17521 - Msg: Create CdvPurchase…
2024-01-16 04:46:11.488 2379-2379 Capacitor/Plugin com.rgtshk.app V To native (Cordova plugin): callbackId: StatusBar1010139604, service: StatusBar, action: _ready, actionArgs:
2024-01-16 04:46:11.489 2379-2466 AndroidRuntime com.rgtshk.app E FATAL EXCEPTION: CapacitorPlugins
Process: com.rgtshk.app, PID: 2379
java.lang.SecurityException: getDeviceId: The uid 10628 does not meet the requirements to access device identifiers.
android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceIdWithFeature(ITelephony.java:11536)
at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:2825)
at org.hygieiasoft.cordova.uid.UID.getImei(UID.java:97)
at org.hygieiasoft.cordova.uid.UID.initialize(UID.java:48)
at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:57)
at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:185)
at org.apache.cordova.PluginManager.exec(PluginManager.java:136)
at com.getcapacitor.MessageHandler.lambda$callCordovaPluginMethod$2(MessageHandler.java:155)
at com.getcapacitor.MessageHandler.$r8$lambda$NhJ0d2egplsDIA6X_OJM4sa5L1w(Unknown Source:0)
at com.getcapacitor.MessageHandler$$ExternalSyntheticLambda2.run(Unknown Source:10)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.os.HandlerThread.run(HandlerThread.java:67)

In the AndroidManifest.xml file, I had set the following permissions:






I tried with my another almost blank cordova project without any errors but I didn’t set any permission but still works! Would you please take a look and advice ? I Google about any security changes on Android 14 and they did mention something “tightening” but I wasn’t so sure.

Thank you.
Louie

p.s. Post the permission here:
uses-permission android:name=“android.permission.INTERNET”
uses-permission android:name=“android.permission.WRITE_EXTERNAL_STORAGE”
uses-permission android:name=“android.permission.ACCESS_NETWORK_STATE”
uses-permission android:name=“android.permission.MODIFY_AUDIO_SETTINGS”
uses-permission android:name=“android.permission.READ_PHONE_STATE”
uses-permission android:name=“com.android.vending.BILLING”
uses-permission android:name=“android.permission.BLUETOOTH_CONNECT”

The error seems to come from org.hygieiasoft.cordova.uid (GitHub - hygieiasoft/cordova-plugin-uid: Cordova plugin to get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC.)

Hello Julio, Yes in fact I just found out that I’d a hidden plugin which didn’t show up in my package.json file. I’ll remove it, try again and update you guys back. Thanks…Louie