Bluetooth discover tests failing while Bluetooth discovery.
phaniranjan opened this issue · 0 comments
While executing BT sample test with multiple devices, BT discovery fails with require ADMIN permissions though AndroidManifest.xml already has configured for the required BT settings and also on the devices MultiDexApplication is give permission for all the requested permissions.
Manfiest File BT Permissions entries :
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
ADB Logcat Logs for both devices with error messages: bluetooth_test.zip
Error message:
C:\git\moblyTests>python bluetooth_test.py -c sample_multiple_Andriod_Devices.yml
[TwoDeviceTestBed] 08-01 15:51:14.936 INFO ==========> HelloWorldTest <==========
[TwoDeviceTestBed] 08-01 15:51:17.826 INFO [AndroidDevice|TE630A2ZM16101724] Logging debug tag set to "discoverer"
[TwoDeviceTestBed] 08-01 15:51:17.827 INFO [AndroidDevice|RZCW409ZSTX] Logging debug tag set to "target"
[TwoDeviceTestBed] 08-01 15:51:17.827 INFO [AndroidDevice|target] Initializing the snippet package com.google.android.mobly.snippet.bundled.
[TwoDeviceTestBed] 08-01 15:51:21.682 INFO [AndroidDevice|discoverer] Initializing the snippet package com.google.android.mobly.snippet.bundled.
[TwoDeviceTestBed] 08-01 15:51:26.764 INFO [Test] test_bluetooth_discovery
[TwoDeviceTestBed] 08-01 15:51:39.665 ERROR Exception occurred in test_bluetooth_discovery.
Traceback (most recent call last):
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\base_test.py", line 779, in exec_one_test
self._setup_test(test_name)
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\base_test.py", line 528, in _setup_test
self.setup_test()
File "C:\git\moblyTests\bluetooth_test.py", line 32, in setup_test
self.discoverer.mbs.btEnable()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\snippet\client_base.py", line 205, in rpc_call
return self._rpc(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\snippet\client_base.py", line 294, in _rpc
return self._handle_rpc_response(rpc_func_name, response_decoded)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\snippet\client_base.py", line 400, in _handle_rpc_response
raise errors.ApiError(self._device, response['error'])
mobly.snippet.errors.ApiError: <AndroidDevice|discoverer>
-------------- Java Stacktrace ---------------
java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10143 nor current process has android.permission.BLUETOOTH_ADMIN.
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.bluetooth.IBluetoothManager$Stub$Proxy.enable(IBluetoothManager.java:515)
at android.bluetooth.BluetoothAdapter.enable(BluetoothAdapter.java:1095)
at com.google.android.mobly.snippet.bundled.bluetooth.BluetoothAdapterSnippet.btEnable(BluetoothAdapterSnippet.java:144)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.android.mobly.snippet.manager.SnippetManager.invoke(SnippetManager.java:287)
at com.google.android.mobly.snippet.manager.SnippetManager.invoke(SnippetManager.java:142)
at com.google.android.mobly.snippet.rpc.MethodDescriptor.invoke(MethodDescriptor.java:101)
at com.google.android.mobly.snippet.util.RpcUtil.invokeRpc(RpcUtil.java:131)
at com.google.android.mobly.snippet.util.RpcUtil.invokeRpc(RpcUtil.java:103)
at com.google.android.mobly.snippet.rpc.JsonRpcServer.handleRPCConnection(JsonRpcServer.java:83)
at com.google.android.mobly.snippet.rpc.SimpleServer$ConnectionThread.run(SimpleServer.java:109)
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.ContextImpl.enforce(ContextImpl.java:1897)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1925)
at com.android.server.BluetoothManagerService.enable(BluetoothManagerService.java:1010)
at android.bluetooth.IBluetoothManager$Stub.onTransact(IBluetoothManager.java:264)
at android.os.Binder.execTransactInternal(Binder.java:1021)
[TwoDeviceTestBed] 08-01 15:51:46.189 INFO [Test] test_bluetooth_discovery ERROR
[TwoDeviceTestBed] 08-01 15:51:47.372 ERROR Failed to stop service "snippets".: <AndroidDevice|target> Failed to stop existing apk. Unexpected output: SNIPPET START, PROTOCOL 1 0
Process crashed before executing the test(s):
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/OutputDirCalculator$outputDir$2;
at androidx.test.platform.io.OutputDirCalculator.(OutputDirCalculator.kt:27)
at androidx.test.platform.io.FileTestStorage.(FileTestStorage.java:45)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:664)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:441)
at com.google.android.mobly.snippet.SnippetRunner.onStart(SnippetRunner.java:139)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2335)
Caused by: java.lang.ClassNotFoundException: androidx.test.platform.io.OutputDirCalculator$outputDir$2
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 6 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Lambda;
... 6 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Lambda" on path: DexPathList[[zip file "/data/app/~~Tr8pUIgkTc0Qd73d03hFTQ==/com.google.android.mobly.snippet.bundled-J6LCM__JilqZQkJm8IbC2Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~Tr8pUIgkTc0Qd73d03hFTQ==/com.google.android.mobly.snippet.bundled-J6LCM__JilqZQkJm8IbC2Q==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 6 more
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
.
Traceback (most recent call last):
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\expects.py", line 152, in expect_no_raises
yield
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\service_manager.py", line 204, in stop_all
service.stop()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\services\snippet_management_service.py", line 116, in stop
client.stop()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\snippet_client_v2.py", line 575, in stop
self._stop_server()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\snippet_client_v2.py", line 623, in _stop_server
raise android_device_lib_errors.DeviceError(
mobly.controllers.android_device_lib.errors.DeviceError: <AndroidDevice|target> Failed to stop existing apk. Unexpected output: SNIPPET START, PROTOCOL 1 0
Process crashed before executing the test(s):
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/OutputDirCalculator$outputDir$2;
at androidx.test.platform.io.OutputDirCalculator.(OutputDirCalculator.kt:27)
at androidx.test.platform.io.FileTestStorage.(FileTestStorage.java:45)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:664)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:441)
at com.google.android.mobly.snippet.SnippetRunner.onStart(SnippetRunner.java:139)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2335)
Caused by: java.lang.ClassNotFoundException: androidx.test.platform.io.OutputDirCalculator$outputDir$2
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 6 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Lambda;
... 6 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Lambda" on path: DexPathList[[zip file "/data/app/~~Tr8pUIgkTc0Qd73d03hFTQ==/com.google.android.mobly.snippet.bundled-J6LCM__JilqZQkJm8IbC2Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~Tr8pUIgkTc0Qd73d03hFTQ==/com.google.android.mobly.snippet.bundled-J6LCM__JilqZQkJm8IbC2Q==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 6 more
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
.
[TwoDeviceTestBed] 08-01 15:51:50.063 ERROR Failed to stop service "snippets".: <AndroidDevice|discoverer> Failed to stop existing apk. Unexpected output: SNIPPET START, PROTOCOL 1 0
Process crashed before executing the test(s):
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Lambda;
at androidx.test.platform.io.FileTestStorage.(FileTestStorage.java:45)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:664)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:441)
at com.google.android.mobly.snippet.SnippetRunner.onStart(SnippetRunner.java:139)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2196)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Lambda" on path: DexPathList[[zip file "/data/app/com.google.android.mobly.snippet.bundled-Llnm2jvJYPEv3_aTJQHXDA==/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.mobly.snippet.bundled-Llnm2jvJYPEv3_aTJQHXDA==/lib/arm, /system/lib, /product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 5 more
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
.
Traceback (most recent call last):
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\expects.py", line 152, in expect_no_raises
yield
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\service_manager.py", line 204, in stop_all
service.stop()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\services\snippet_management_service.py", line 116, in stop
client.stop()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\snippet_client_v2.py", line 575, in stop
self._stop_server()
File "C:\Users\Phani.Ranjan.AD\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mobly\controllers\android_device_lib\snippet_client_v2.py", line 623, in _stop_server
raise android_device_lib_errors.DeviceError(
mobly.controllers.android_device_lib.errors.DeviceError: <AndroidDevice|discoverer> Failed to stop existing apk. Unexpected output: SNIPPET START, PROTOCOL 1 0
Process crashed before executing the test(s):
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Lambda;
at androidx.test.platform.io.FileTestStorage.(FileTestStorage.java:45)
at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:664)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:441)
at com.google.android.mobly.snippet.SnippetRunner.onStart(SnippetRunner.java:139)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2196)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Lambda" on path: DexPathList[[zip file "/data/app/com.google.android.mobly.snippet.bundled-Llnm2jvJYPEv3_aTJQHXDA==/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.mobly.snippet.bundled-Llnm2jvJYPEv3_aTJQHXDA==/lib/arm, /system/lib, /product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 5 more
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
.
[TwoDeviceTestBed] 08-01 15:51:50.142 INFO Summary for test class HelloWorldTest: Error 2, Executed 1, Failed 0, Passed 0, Requested 1, Skipped 0
[TwoDeviceTestBed] 08-01 15:51:50.142 INFO Summary for test run TwoDeviceTestBed@08-01-2023_15-51-14-886:
Total time elapsed 35.21022209999501s
Artifacts are saved in "C:\tmp\logs\mobly\TwoDeviceTestBed\08-01-2023_15-51-14-886"
Test summary saved in "C:\tmp\logs\mobly\TwoDeviceTestBed\08-01-2023_15-51-14-886\test_summary.yaml"
Test results: Error 2, Executed 1, Failed 0, Passed 0, Requested 1, Skipped 0