How can I fix “Design editor is unavailable until a successful build” error?

前端 未结 17 1400
刺人心
刺人心 2020-11-30 01:31

I started to learn Android Studio from yesterday. I try to echo out simple \"Hello World\":




        
相关标签:
17条回答
  • 2020-11-30 02:00

    In my case, the Windows Firewall was blocking Android Studio (i.e. java.exe from Android Studio's jre/bin folder) from connecting to sites and downloading data. After Windows asked me if I wanted to allow the app through the firewall, I had to do a manual sync File -> Sync project with gradle files. After that, things were still disfunctional, a manual download of an SDK version 28 was necessary from Tools -> SDK Manager.

    0 讨论(0)
  • 2020-11-30 02:01

    I got this problem after i added a line in my build.gradle file.

    compile 'com.balysv:material-ripple:1.0.2'
    

    Solution: I changed this line to

    implementation 'com.balysv:material-ripple:1.0.2'
    

    and then pressed sync again.

    Tada! all was working again.

    0 讨论(0)
  • 2020-11-30 02:02

    Install missing plataform and sync project

    0 讨论(0)
  • 2020-11-30 02:05

    None of the above worked for me. what worked for me is to go to File -> Invalidate Caches / Restart

    0 讨论(0)
  • 2020-11-30 02:07

    there are different solutions to this problem but I at the first u have to check to (build.gradle) maybe it empty. this especially if u downloaded code, not u created
    and u will find just this line "// Top-level build file where you can add configuration options common to all sub-projects/modules." in this case, u need to open a new project and make copy-paste.then check the SDK and other settings.finally u have to sync

    0 讨论(0)
  • 2020-11-30 02:09

    I have the latest Android Studio 3.6.1 and yet couldn't build a simple 'Hello World' app as documented here "https://codelabs.developers.google.com/codelabs/android-training-hello-world/index.html?index=..%2F..%2Fandroid-training#3". I applied various steps discussed above including the 2 most viable options which should have really solved this issue,

    1. 'File->Sync Project with Gradle Files' and
    2. 'File->Invalidate Caches/Restart' but to no avail.

    Even though, I suspect standard answer should be one of these 2 options only for most, but for me the resolution came only after I went inside the 'File->Project Structure' and checked my SDK versions configured! Android Studio and Gradle were using different JDK versions and locations.

    • Android Studio: C:\Program Files\Java\jdk1.8.0_241
    • Gradle: C:\Program Files\Java\jdk-13.0.2

    I had previously defined my JAVA_HOME environment variable by downloading latest JAVA SDK on my own from ORACLE website. Where Gradle was using the %JAVA_HOME% JAVA SDK version and Android Studio the built in SDK which came along with Android Studio.

    Once I switched both to versions JDK 1.8.* (Any version as long as it is JDK 1.8. for that matter*) then simple 'File->Synch...' option worked perfectly fine for me!

    Good luck the solution is in between one of these 2 options only if you are stuck, just ensure you validate JDK versions being referred to!

    0 讨论(0)
提交回复
热议问题