Sorry in advance if this is a duplicate, I couldn't find a solution to this exact problem posted anywhere.
I'm using Unity on macOS and I am trying to build for Android. I'm running into an issue where my development phone (it's a Galaxy A5 2017) will start charging my MacBook when I plug it in and will not show up as an adb device.
What I've done so far is:
- Enable USB debugging on my phone
- Install android-sdk and android-platform-tools through homebrew
- Install openjdk@8 through homebrew (this resolved an issue where the sdk required java 8)
- Attempt to switch the USB mode on the phone from 'Charge connected device' to 'Transfer files'
- Switch USB ports
Trying to switch USB modes on the phone does not seem to work, it will close the dialog when selecting 'Transfer files' but when I check in the notification shade it will still be set to 'Charge connected device'. I also tried checking if the phone showed up over adb, but unfortunately
adb devices returns an empty list.
Potentially useful information: I have built this exact Unity project to this exact phone successfully from my Windows desktop with this USB C to C cable, but I need to be able to do this from my MacBook.
I am using:
- Unity 2021.1.4f
- macOS Big Sur 11.4
- Android 8.0.0
My question is, how can I prevent my phone from trying to charge the Mac? How can I get it to show up as an adb device so I can build to it from Unity?
Edit: alecxs suggested another question as a possible solution but this did not work for me either. In USB debugging, the USB mode is still set to MTP file transfer when this issue occurs. Changing it to something else and back unfortunately does not resolve the issue.
Edit 2: looks like this is a problem with macOS. I came across this article that mentioned for Samsung phones you need to use Smart Switch. I downloaded it for macOS, but it warned me that until further notice they do not support Big Sur as their system extension has not been approved. There is a temporary workaround mentioned in the warning here, but it is a bit involved, requiring you to disable SIP. For now this seems like the only solution. Since I know the root of the issue, I will mark this question as solved.