Could not determine the class-path for interface c

2020-05-12 04:46发布

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 interface com.android.builder.model.AndroidProject. Anyone knows why it happened? Thanks!

enter image description here enter image description here

7条回答
姐就是有狂的资本
2楼-- · 2020-05-12 05:07

Palanivelraghul was right. A Studio has to download the old version. Then it presented 3 different options after it was complete.

Choose the top option ~"Sync with 3.0.1".

Event Log:

Gradle sync started > Project setup started > Gradle sync finished > Executing tasks:

[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar] > Gradle build finished.
查看更多
ゆ 、 Hurt°
3楼-- · 2020-05-12 05:18

I got it working after upgrading build tools to version 25.0.0 in build.gradle:

buildToolsVersion '25.0.0'

And change project to use newest gradle version 3.3 with default gradle wrapper (File -> Settings -> Gradle)

查看更多
劳资没心,怎么记你
4楼-- · 2020-05-12 05:22

Just Update two things:-

1) Update your Build.gradle to

dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
}

2) Update Gradle-wrapper.properties: (Change Android mode > Project mode then Extend Gradle and open Gradle-wrapper.properties)

Replace distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip By

distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip

This always resolves the issue. may it usefull for you

查看更多
混吃等死
5楼-- · 2020-05-12 05:22

In my case I removed folder .idea from the project and then restarting the studio automatically manages to all the required folder and gradle work.

查看更多
Anthone
6楼-- · 2020-05-12 05:27

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. enter image description here

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. enter image description here

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: enter image description here

[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. enter image description here 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. enter image description here

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

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

查看更多
走好不送
7楼-- · 2020-05-12 05:29

First, delete your .gradle folder in the home directory then restart Android Studio.

查看更多
登录 后发表回答