AndroidStudio總結:No service of type Factory available in ProjectScopeServices

從Git上拉取完代碼,在Android Studio中打開時,出現:Gradle sync failed: No service of type Factory available in ProjectScopeServices.

通過查詢問題,在Stack Overflow找到解決辦法如下:
修改工程目錄下的build.gradle文件
修改前:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.github.dcendents:android-maven-plugin:1.4.1'    //替換掉這一行
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

修改後:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'   //替換爲這一行
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

也就是把android-maven-plugin修改爲android-maven-gradle-plugin;
重新同步一下工程即可;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章