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;
重新同步一下工程即可;

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