My phone is charging my MacBook over USB C, and not showing up as an adb device. Is there a fix?


Question

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.


Answer

I believe I've found the issue, I added an edit to the original post. 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 that can be found here, but it is a bit involved, requiring you to disable SIP. For now this seems like the only solution until Apple approves the extension.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes