简体   繁体   English

android gradle 项目刷新失败:设备未就绪

[英]android gradle project refresh fail: The device is not ready

When i have move my project to my laptop and import it in file/import project, Android studio alert me当我将我的项目移动到我的笔记本电脑并将其导入文件/导入项目时,Android studio 提醒我

project refresh failed项目刷新失败

Error: The device is not ready错误:设备未就绪

错误

Look inside your gradle file for lines something like this (this is mine): 在你的gradle文件中查找类似这样的行(这是我的):

maven {
    url "D:/Android/sdk/extras/android/m2repository"
}

I do not have drive D:\\ with Android SDK on my new laptop. 我的新笔记本电脑上没有驱动器D:\\Android SDK That is why I met the error: 这就是我遇到错误的原因:

Gradle sync failed: The device is not ready
Consult IDE log for more details (Help | Show Log)

In the Android Studio's log I found the line: Android Studio的日志中,我发现了以下行:

Caused by: org.gradle.api.UncheckedIOException: Could not normalize path for file 'D:\Android\sdk\extras\android\m2repository'.

Hope this post will help other people to handle this error quickly. 希望这篇文章能帮助其他人快速处理这个错误。

try this algorythm: 试试这个algorythm:

  1. File -> Invalidate caches / Restart 文件 - >无效缓存/重新启动
  2. Shutdown Android Studio 关闭Android Studio
  3. Rename/remove .gradle folder in the user home directory 重命名/删除用户主目录中的.gradle文件夹
  4. Restart Android Studio let it download all the Gradle stuff it needs 重启Android Studio,让它下载所需的所有Gradle内容
  5. Gradle build success Gradle建立成功
  6. Rebuild your project 重建您的项目

You should connect your android device to computer i think you have driver problem .and you should install your device driver if you use windows bellows link show you how to install driver 您应该将您的Android设备连接到计算机我认为您有驱动程序问题。如果您使用Windows,您应该安装您的设备驱动程序bellows链接显示如何安装驱动程序

Manually installing Android ADB USB Driver 手动安装Android ADB USB驱动程序

If you have implemented product flavors in a project then please check implementation and keystore path. 如果您已在项目中实现了产品风格,请检查实现和密钥库路径。 In my case it was the reason and i have corrected keystore file path in gradle it is working fine now. 在我的情况下,这是原因,我已经更正了gradle中的密钥库文件路径,它现在工作正常。

I had system environment variables GRADLE_HOME and GRADLE_USER_HOME set to non existings directory, which I had to remove to fix a similar issue.我将系统环境变量 GRADLE_HOME 和 GRADLE_USER_HOME 设置为不存在的目录,我必须将其删除以解决类似的问题。

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

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