简体   繁体   中英

Android Studio: Failed to initialize editor

I'm new with Android Studio technology. I've just launched a new empty project from scratch on Windows 10 machine. At first in my activity_main.xml file I could see an error "editor is unavaible until next gradle synch". After clicking on "Synch Project with Gradle Files" the error message turns into "Failed to initialize editor" as you can see on the pic below:

在此处输入图像描述

As you can see build console shows no errors. Also green arrow on the top bar is muted. How can I fix this issue?

Android Studio version: 4.02 JDK version: 1.8.0_261

Note I've got Avast Antivirus installed on my computer. I'm not sure if it changes anything but in few similar topics people repored this program as an issue interfering with Android Studio. However my avast quarantine remains empty.

Update/Solution In my case it turned out that downgrading my Android Studio from 4.0.2 to 3.5.3 version solved this problem. Now everything works fine.

I don't know why it happened, it happened for me on a project that was working earlier. Helped me File -> Invalidate Cashes / Restart in Android Studio

我不确定是什么导致了这个错误,但你可以通过首先关闭项目并删除项目的 .idea\\codeStyles\\ 目录中的 project.xml 文件来解决它,一旦你重新打开你的项目,你就会得到一个弹出窗口提示你重新配置这个文件,之后一切都应该没问题,

In my case, I simply had to exit Android Studio and relaunch it. :)

This will Helps me all the time :

Open the project then

File > Invalidate Caches and Restart > Invalidate Restart This step will fix your project. step 1

step 2

I solved this problem by deleting the inspectionProfiles folder under the project's.idea folder and upgrading the gradle version.

Version: Android Studio Dolphin | 2021.3.1

None of the solutions here worked for me. I tried invalidating caches, restarting AS, rebooting my PC, deleting .gradle .idea, build and app/build
The only way I was able to make it work as before was to roll back to a saved copy I (luckily) had (v3.6.3).
The problem happened immediately after I naively clicked on the offered updates (AS+gradle).

I had to clean install android studio but it didn't fix it until I deleted this folder %APPDATA%\\Google\\AndroidStudio* .

This might be because of Toolbox since that's what I was using to update android studio when this happend.

It is because of the incompatible AGP version. AGP = Android Gradle Plugin

You can resolve it by two methods.

1> upgrading the agp of your project.

2> downgrading the android studio version.

You can find all the versions over here.

https://developer.android.com/studio/archive?authuser=1

Recommended:- upgrade the agp of your project.

Update Gradle and plugins in project to latest, then invalidate cache and restart

To Solve failed to initialize editor in android studio You need to update Android Gradle Plugin. First of all Open your File -> Project Structure ( Ctrl + Alt + Shift + S ) -> Project Then You need to update Android Gradle Plugin Version to 7.3.0 and Gradle Version to 7.4. And then You need to invalidate cache and restart your IDE will resolve your error.

reference: https://exerror.com/failed-to-initialize-editor-in-android-studio/

I have updated the Dolphin version today (Android Studio Dolphin | 2021.3.1 Patch 1). Now everything works.

Attention: After update you must invalidate your Android Studio Cache

HI i update gradle plugin to 7.3.0 and wrapper to gradle-7.4-bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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