Could not determine the class-path for interface com.android.builder.model.AndroidProject

后端 未结 7 437
梦谈多话
梦谈多话 2021-01-30 08:10

When I import an Eclipse project into Android Studio, I got this problem: Gradle \'XNote\' project refresh failed Error:Could not determine the class-path for interfa

7条回答
  •  盖世英雄少女心
    2021-01-30 09:05

    I have solved this problem.

    Google doesn't update ADT any more, so when Eclipse export a project to gradle, it use an old gradle plugin version that Android Studio doesn't support.

    First, you should check the version of gradle plugin that you have installed. Open Android Studio's installation directory,then open the directory \gradle\m2repository\com\android\tools\build\gradle\, you will see all version you have installed.

    Then open Android Studio, open tab 'Project -> Gradle Scripts', Edit file build.gradle, change the gradle plugin to newest version you have installed, such as 2.3.0:

    [OPTIONAL] This step is not necessary, but if you do not do this, you may see this problem:

    A problem occurred evaluating root project 'XXX'.
    > org/gradle/initialization/BuildCompletionListener
    

    Check the newest version of gradle you have installed at C:\Users\YOUR USER NAME\.gradle\wrapper\dists. Then open tab 'Project -> Gradle Scripts', edit file gradle-wrapper.properties, modify the gradle version(attention: gradle, NOT gradle plugin) to the newest at the last line.

    Finally, click Build - Clean Project, done! If it still warning "Gradle project sync failed...", just click Try Again!

    AT THE END, SOMEBODY HELP ME TO TRANSLATE MY ANSWER TO REAL ENGLISH THAT NO grammatical mistakes!!!

提交回复
热议问题