Android Studio 1.3.2 error when refreshing gradle

前端 未结 2 693
清歌不尽
清歌不尽 2021-01-16 15:53

I generated build.gradle file from eclipse and import it to android studio.

However, it returns error after \"refreshing gradle\" :

相关标签:
2条回答
  • 2021-01-16 16:44

    Don't confuse the gradle-plugin for Android and gradle.
    They are different. You can find more info about the android plugin here

    With the classpath inside your gradle files, you set the version of the android plugin for Gradle.

    Change your classpath using:

    classpath 'com.android.tools.build:gradle:1.3.1'
    

    instead of:

    classpath 'com.android.tools.build:gradle-1.12'
    

    In the gradle-wrapper.properties file you set the version of the Gradle. For example the 2.4 version.

    distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
    
    0 讨论(0)
  • 2021-01-16 16:48

    I recommend you to use gradle 2.4, you can download it here. Then, extract the downloaded file into C:\Program Files\Android\Android Studio\gradle. After that, open File > Settings from Android Studio. On the searchbox, type gradle and search.

    Open build.gradle from the main project and type classpath 'com.android.tools.build:gradle:1.3.0' under dependencies:

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.3.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    

    Finally, rebuild your project in Build > Rebuild project.

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