简体   繁体   English

React-Native、Android、Genymotion:ADB 服务器没有 ACK

[英]React-Native, Android, Genymotion: ADB server didn't ACK

I am working with React-Native, Android, and Genymotion on Mac.我正在 Mac 上使用 React-Native、Android 和 Genymotion。 When I run react-native run-android I get this lines at the end of the launch operation:当我运行react-native run-android我在启动操作结束时得到以下几行:

...
04:54:40 E/adb: error: could not install *smartsocket* listener: Address already in use
04:54:40 E/adb: ADB server didn't ACK
04:54:40 E/ddms: '/Users/paulbrie/Library/Android/sdk/platform-tools/adb,start-server' failed -- run manually if necessary
04:54:40 E/adb: * failed to start daemon *
04:54:40 E/adb: error: cannot connect to daemon
:app:installDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: Timeout getting device list.
...

However, adb devices returns this:但是, adb devices返回这个:

List of devices attached
192.168.59.101:5555 device

So far I've found no solution to run my app on the emulator.到目前为止,我还没有找到在模拟器上运行我的应用程序的解决方案。 Has anyone encountered the same issue?有没有人遇到过同样的问题?

Thanks, Paul谢谢,保罗

After more research I've realized that Genymotion uses by default its own adb.经过更多研究,我意识到 Genymotion 默认使用自己的 adb。

在此处输入图片说明

I switched to my main adb (the same used by react-native) and it solved the issue.我切换到我的主 adb(与 react-native 使用的相同)并解决了这个问题。 I guess that because Genymotion's adb was launched first I got the Address already in use error message.我猜是因为首先启动了 Genymotion 的 adb,所以我收到了Address already in use错误消息。

I am using genymotion, but Paul's solution alone did not fix the error (for Mac).我正在使用 genymotion,但 Paul 的解决方案本身并没有修复错误(对于 Mac)。

I had to:我不得不:

Update Android SDK to the latest version (24.4.1) via the SDK manager通过 SDK 管理器将 Android SDK 更新到最新版本 (24.4.1)

Type android in the command line在命令行输入android

In the SDK manager find the latest SDK tools and install.在 SDK 管理器中找到最新的 SDK 工具并安装。

Once installed the SDK path should update the new SDK location like below.安装后,SDK 路径应更新新的 SDK 位置,如下所示。

在此处输入图片说明

Then update the $ANDROID_HOME to use the new SDK然后更新 $ANDROID_HOME 以使用新的 SDK

export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1

export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Confirm it has been added by viewing your path with echo $PATH通过使用echo $PATH查看您的路径来确认它已添加

Then in genymotion do what @Paul says above and point genymotion ADB to use the same sdk然后在 genymotion 中执行 @Paul 上面所说的并指向 genymotion ADB 使用相同的 sdk

在此处输入图片说明

System: Windows 10系统: Windows 10

My issue: Setting Genymotion to point to the custom SDK didn't have any affect.我的问题:将 Genymotion 设置为指向自定义 SDK 没有任何影响。 I still received the:我还是收到了:

Couldn't start project on Android: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted.无法在 Android 上启动项目:无法安装智能套接字侦听器:无法绑定到 127.0.0.1:5037:通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048) could not read ok from ADB Server * failed to start daemon * error: cannot connect to daemon (10048) 无法从 ADB 服务器读取 ok * 无法启动守护程序 * 错误:无法连接到守护程序

What I discovered was there was a difference in ADB versions being used throughout the system.我发现整个系统中使用的 ADB 版本存在差异。 Here is the command I used to find them:这是我用来查找它们的命令:

where /r C:\ adb.exe

This produced the results:这产生了结果:

C:\Program Files\Expo XDE\resources\app\node_modules\xdl\binaries\windows\adb\adb.exe
C:\Program Files\Genymobile\Genymotion\tools\adb.exe
C:\Users\kyle\AppData\Local\Android\Sdk\platform-tools\adb.exe
C:\Users\kyle\AppData\Local\Android\Sdk\platform-tools\adb backup\adb.exe

Navigating to each directory and running:导航到每个目录并运行:

adb.exe version

Allowed me to see that Expo was running ADB version:让我看到 Expo 正在运行 ADB 版本:

Android Debug Bridge version 1.0.36
Revision fd9e4d07b0f5-android

While Genymotion using the custom SDK had version (c:\\Users\\kyle\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe):虽然使用自定义 SDK 的 Genymotion 有版本 (c:\\Users\\kyle\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe):

Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android

As a test I took the adb files (adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll) from作为测试,我从

c:\Users\kyle\AppData\Local\Android\Sdk\platform-tools\adb.exe

and placed them into a backup folder.并将它们放入备份文件夹中。 I then moved the adb files located at然后我移动了位于

c:\Program Files\Expo XDE\resources\app\node_modules\xdl\binaries\windows\adb\adb.exe

into that same location.进入同一个位置。 I killed adb with:我用以下命令杀死了 adb:

adb kill-server

which caused a restart of the adb server automatically due to having my Genymotion device already running.由于我的 Genymotion 设备已经在运行,这导致 adb 服务器自动重启。 I hit the "Restart" button inside of the Expo XDE and it immediately began working.我点击了 Expo XDE 内的“重启”按钮,它立即开始工作。 Here is the log where I hit the restart button at 1:13:04 AM:这是我在凌晨 1:13:04 按下重启按钮的日志:

12:45:53 AM
could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
1:13:04 AM
Restarting project and clearing packager cache (Hold shift while clicking restart to avoid clearing cache).
1:13:11 AM
Starting React Native packager...
1:13:17 AM
Scanning 543 folders for symlinks in C:\Users\kyle\git\betalog\node_modules (49ms)
1:13:17 AM
1:13:19 AM
Couldn't adb reverse: closed
1:13:20 AM
Project opened! You can now use the "Share" or "Device" buttons to view your project.
1:13:26 AM
Couldn't adb reverse: closed
1:13:26 AM
Downloading latest version of Expo
1:13:28 AM
Installing Expo on device
1:13:33 AM
Opening on Android device
1:13:56 AM
Building JavaScript bundle: finished in 59643ms.
1:14:01 AM
Dependency graph loaded.
1:14:03 AM
Your JavaScript transform cache is empty, rebuilding (this may take a minute).

Conclusion: Genymotion and Expo may need to use the same version of adb so that Expo can properly communicate with the simulated device.结论: Genymotion 和 Expo 可能需要使用相同版本的 adb,以便 Expo 可以与模拟设备正确通信。 Pointing Genymotion to your android SDK location as well as ensuring Expo XDE has that same version will allow correct communication between devices.将 Genymotion 指向您的 android SDK 位置并确保 Expo XDE 具有相同版本将允许设备之间正确通信。 I moved the Expo XDE version to the SDK location, but you might be able to go the other way (take the sdk ADB files and place them in the Expo XDE resource location).我将 Expo XDE 版本移到了 SDK 位置,但您可能可以采用另一种方式(获取 sdk ADB 文件并将它们放在 Expo XDE 资源位置)。

PS I've been all through the stackoverflow posts related to this issue. PS我已经阅读了与此问题相关的所有 stackoverflow 帖子。 Just so you guys know my task manager shows three instances of adb.exe running.只是为了让你们知道我的任务管理器显示了三个正在运行的 adb.exe 实例。 If you kill any of them they just come back.如果你杀了他们中的任何一个,他们就会回来。

Hope this helps /cheers希望这有帮助/干杯

Maybe your adb versions are mismatching也许你的 adb 版本不匹配

Check:查看:

adb version 

Then:然后:

cd /Path/to/Android/Sdk/platform-tools && ./adb version

If these two are different you have an error here, just remove adb from sys and copy the one that is in platform-tools to /usr/bin/如果这两个不同,你在这里有错误,只需从 sys 中删除 adb 并将 platform-tools 中的一个复制到 /usr/bin/

If want to keep your system clean, you can also use Genymotion without Android Studio :如果想保持系统干净,您也可以使用 Genymotion 而不使用 Android Studio

  1. Find Genymotion's copy of adb .找到 Genymotion 的adb副本。 On macOS this is normally /Applications/Genymotion.app/Contents/MacOS/tools/ .在 macOS 上,这通常是/Applications/Genymotion.app/Contents/MacOS/tools/
  2. Add the Genymotion tools directory to your path - execute/add the line export PATH=/Applications/Genymotion.app/Contents/MacOS/tools/:$PATH to your ~/.bash_profile or ~/.bash_rc .将 Genymotion 工具目录添加到您的路径 - 执行/添加export PATH=/Applications/Genymotion.app/Contents/MacOS/tools/:$PATH到您的~/.bash_profile~/.bash_rc
  3. Make sure that you can run adb from your terminal.确保您可以从终端运行 adb。

(From https://docs.expo.io/versions/latest/workflow/genymotion ) (来自https://docs.expo.io/versions/latest/workflow/genymotion

the adb version on your system is different from the adb version on the android sdk platform-tools .您系统上的 adb 版本与 android sdk platform-tools 上的 adb 版本不同。 Below suggestion is work for me for Linux operating system以下建议适用于 Linux 操作系统

  1. check sys adb version run the below command检查 sys adb 版本运行以下命令

adb version亚行版

Android Debug Bridge version 1.0.39 Android 调试桥版本 1.0.39

  1. check sdk adb version检查 sdk adb 版本

cd /root/Android/Sdk/platform-tools cd /root/Android/Sdk/platform-tools

./adb version ./adb 版本

Android Debug Bridge version 1.0.32 Android 调试桥版本 1.0.32

  1. copy复制

rm /usr/bin/adb rm /usr/bin/adb

[Note : the above command remove the existing adb then copy the adb from sdk/platform-tools directory ] [注意:上述命令删除现有的 adb,然后从 sdk/platform-tools 目录中复制 adb]

sudo cp /root/Android/Sdk/platform-tools/adb /usr/bin/adb须藤cp /root/Android/Sdk/platform-tools/adb /usr/bin/adb

Then run the project using this command然后使用此命令运行项目

react-native run-android react-native run-android

I had the same thing while I tried to run from expo UI.当我尝试从 expo UI 运行时,我遇到了同样的事情。 Did the same things, as described in answers, but app was not running.做了同样的事情,如答案中所述,但应用程序没有运行。 When once tried run exp android from command line (in the project folder), application ran successfully and next times runs from Expo UI was successfully.当一次尝试从命令行(在项目文件夹中)运行exp android ,应用程序运行成功,下次从 Expo UI 运行成功。

I had a similar issue.我有一个类似的问题。

First, I uninstalled the app.首先,我卸载了该应用程序。 Then, I pointed GenyMotion to the android sdk provided from Android Studio Next, I ran "adb kill-server" into the terminal.然后,我将 GenyMotion 指向 Android Studio 提供的 android sdk 接下来,我在终端中运行“adb kill-server”。 Finally, I re-ran "react-native run-android" and got a build success.最后,我重新运行了“react-native run-android”并获得了构建成功。

The steps worked for me are :对我有用的步骤是:

  • $ adb kill-server $ adb kill-server

  • $ adb start-server $ adb 启动服务器

  • $ cd android $ cd 安卓

  • $ ./gradlew clean $ ./gradlew 干净

  • $ cd .. $ cd ..

  • $ react-native run-android $ react-native run-android

For Ubuntu对于 Ubuntu

It works for me!!这个对我有用!!

  1. check sys adb version检查系统 adb 版本

adb version亚行版

Android Debug Bridge version 1.0.39 Android 调试桥版本 1.0.39

2 check sdk adb version 2 检查sdk adb 版本

cd /home/user_name/Android/sdk/platform-tools cd /home/user_name/Android/sdk/platform-tools

./adb version ./adb 版本

Android Debug Bridge version 1.0.32 Android 调试桥版本 1.0.32

  1. copy复制

sudo cp /home/user_name/Android/sdk/platform-tools/adb /usr/local/bin须藤cp /home/user_name/Android/sdk/platform-tools/adb /usr/local/bin

that's all!就这样! It will work now.它现在会起作用。

1.use custom sdk path in genymotion.(Suppose this one won't work means,Try to execute the second one) 1.在genymotion中使用自定义sdk路径。(假设这一个不起作用意味着,尝试执行第二个)

2.Manually use this command to execute(SDK PATH/adb she ll am start -n/Package name/MainActivity). 2.手动使用此命令执行(SDK PATH/adb she ll am start -n/Package name/MainActivity)。

C:\\Users\\AppData\\Local\\Android\\Sdk/platform-tools/adb she ll am start -n com.example/com.example.ManiActivity C:\\Users\\AppData\\Local\\Android\\Sdk/platform-tools/adb she ll am start -n com.example/com.example.ManiActivity

And try to run the application by using react-native run-android.并尝试使用 react-native run-android 运行应用程序。

Same issue happened when I try to run my react-native project in Genymotion当我尝试在 Genymotion 中运行我的 react-native 项目时发生了同样的问题

For Linux ubuntu 20.04 Go to /home/mycomputer/Android/Sdk/platorm-tools对于 Linux ubuntu 20.04 转到/home/mycomputer/Android/Sdk/platorm-tools

run $./adb version运行$./adb version

just copy the adb path in /usr/bin只需将 adb 路径复制到/usr/bin

$ sudo cp /home/raik/Android/Sdk/platform-tools/adb /usr/bin

Then I can run my project in genymotion.然后我可以在 genymotion 中运行我的项目。

Note: In some Linux system may be copied to this path /usr/local/bin`注意:在某些Linux系统中可能会复制到这个路径/usr/local/bin`

If someone is facing this issue in Windows with Android Studio emulator then just run following command in powershell or cmd:如果有人在使用 Android Studio 模拟器的 Windows 中遇到此问题,则只需在 powershell 或 cmd 中运行以下命令:

taskkill /F /IM adb.exe

It should kill all the adb process instances and then you can Reload the app or Start the App on Android again via Expo CLI.它应该杀死所有 adb 进程实例,然后您可以通过 Expo CLI 重新加载应用程序或再次在 Android 上启动应用程序。

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

相关问题 Genymotion在Windows上不起作用“ ADB服务器未确认” - Genymotion doesn't work “ADB server didn't ACK” on Windows ADB服务器在macOS上没有确认 - ADB server didn't ACK on macOS Android ADB在eclipse中没有问题 - Android ADB didn't ack issue in eclipse adb服务器版本(36)与该客户端(39)不匹配。不使用Genymotion。 尝试在移动设备上渲染本机项目 - adb server version (36) doesn't match this client (39) Not using Genymotion. Trying to render react-native project on mobile Mac上Android studio3.3.2错误“ADB服务器没有ACK,无法启动守护进程” - Android studio3.3.2 error “ADB server didn't ACK, failed to start daemon” on Mac "Eclipse 错误“ADB 服务器未确认,无法启动守护程序”" - Eclipse error "ADB server didn't ACK, failed to start daemon" adb服务器在处理MAC时没有确认 - adb server didn't ACK while working on MAC React-Native Android FCM:没有获得令牌 - React-Native Android FCM: Didn't get a token adb服务器已过期。 正在杀死…ADB服务器未确认*无法启动守护程序* - adb server is out of date. killing… ADB server didn't ACK * failed to start daemon * Appcelerator Studio / Titanium:错误:无法启动ADB(代码255):ADB服务器未确认 - Appcelerator Studio / Titanium: Error: Failed to start ADB (code 255): ADB server didn't ACK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM