How to view logs while debugging on Android device

I need to debug my game on a real device (in order to see conole.log() and possible crash messages). I’ve followed the instructions at here. It says that I need to build in debug mode and run it on the device and then open a URL. My problem is that if I check the debug flag the build fails with this error:

[runCmd C:\Users\MrAlone\Documents\Projects\Games\Cocos\Archer\build\android\proj\gradlew.bat] > Task :Archer:mergeDebugResources FAILED
C:\CocosDashboard_1.…\lib\renderer.ccc:1 [runCmd C:\Users\MrAlone\Documents\Projects\Games\Cocos\Archer\build\android\proj\gradlew.bat - error] Could not resolve all files for configuration ':Archer:_internal_aapt2_binary'.
   > Could not find aapt2-4.1.0-6503028-windows.jar (com.android.tools.build:aapt2:4.1.0-6503028).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.1.0-6503028/aapt2-4.1.0-6503028-windows.jar

But if I build without the debug flag the game builds successfully and runs on the device but then when I go to the specified URL I get the following error message:

Both devices are on the same local network so I’m not sure what could be the problem. (using Cocos Creator v3.5.2)
Any help would be really appreciated. Thanks

Ok I solved the debug build error! For anyone who encounters this build issue you need to delete the “caches” directory inside the “.gradle” folder which is located in your user directory. After the debug build was successful everything else worked as expected. :upside_down_face: