简体   繁体   English

Android Studio 无法连接到设备

[英]Android Studio not connecting to devices

I am having an issue with Android Studio not connecting to any devices.我遇到了 Android Studio 无法连接到任何设备的问题。 This includes physical devices, as well as emulators.这包括物理设备以及模拟器。 Everything was working, but I updated AS to the latest version, and now it is not working.一切正常,但我将 AS 更新到最新版本,现在无法正常工作。 The devices still show as connected when I use adb on the command line, so I am able to run commands through that.当我在命令行上使用 adb 时,设备仍然显示为已连接,因此我可以通过它运行命令。 However, I can not run anything from Android Studio, or debug, or use logcat.但是,我无法从 Android Studio 运行任何东西,也无法调试或使用 logcat。 What could possible be the issue where adb is connected to the devices, but Android Studio is not? adb 连接到设备但 Android Studio 没有连接到设备的问题可能是什么?

Even using the connection assistant shows that I have a pixel connected, but AS does not recognize it as an android device.即使使用连接助手显示我连接了一个像素,但AS无法将其识别为android设备。 在此处输入图片说明

I'm running on a mac with Yosemite.我在装有 Yosemite 的 Mac 上运行。 I tried running old versions of Android Studio that were laying around which was a waste of time.我尝试运行旧版本的 Android Studio,这是在浪费时间。 So I got drastic.所以我变得很激烈。

This is a really bad solution , but has allowed me to actually get back to work.这是一个非常糟糕的解决方案,但让我能够真正重新开始工作。

  1. Completely uninstall Android Studio and the Android SDK (the sdk might have been over-kill, but I'll let someone else figure that out).完全卸载 Android Studio 和 Android SDK(sdk 可能已经过时了,但我会让其他人解决这个问题)。 If you like, here's a website that helps uninstall AS.如果您愿意,这里有一个帮助卸载 AS 的网站。 https://nektony.com/how-to/uninstall-android-studio-on-mac https://nektony.com/how-to/uninstall-android-studio-on-mac
  2. Re-install Android Studio using an older version.使用旧版本重新安装 Android Studio。 I used 3.5.2 because I liked that color of green better than the new one.我使用 3.5.2 是因为我比新的更喜欢绿色。 The link to find it: https://developer.android.com/studio/archive (you'll have to agree to their terms before being able to even look at the list!).找到它的链接: https : //developer.android.com/studio/archive (在查看列表之前,您必须同意他们的条款!)。
  3. Run the newly-installed AS.运行新安装的AS。 Connect your device (remember to turn dev-mode!)...voila!连接您的设备(记得打开开发模式!)...瞧!

Well, it worked for me.嗯,它对我有用。 And I only wasted 1 day.而我只浪费了1天。

This is for Android Studio 3.6.2, updated recently: Directory 'platform-tools' contains a directory of the same name, and I made the hypothesis that this was a bug and that the lower dir should not the there.这是针对最近更新的 Android Studio 3.6.2:目录 'platform-tools' 包含一个同名目录,我假设这是一个错误并且较低的目录不应该在那里。 Using the Mac Finder, I copied all files and directories from the lower dir to the upper one, I closed and restarted Android Studio, and voila, the Run > Select Device... can see my tablet, and I could run the app on it.使用 Mac Finder,我将所有文件和目录从较低的目录复制到较高的目录,关闭并重新启动 Android Studio,瞧,运行 > 选择设备...可以看到我的平板电脑,我可以在上面运行应用程序它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM