android studio:ProjectScopeServices中没有可用的Factory类型的服务

时间:2017-02-09 22:12:28

标签: android android-studio

我尝试开始this Android Studio app

当我用android studio打开应用程序时出现此错误:

No service of type Factory available in ProjectScopeServices

我是android studio的新手但我尝试用seachring解决这个问题:

我的android studio版本是2.2.3和Android SDK工具:25.2.5。/ tools版本:25.0.2

我提取应用程序并编辑它以便工作我的android studio版本:

build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'

}

我看了this并将其更改为:

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}

我还将 gradle.properties 更改为:

VERSION_NAME=1.2.0
VERSION_CODE=22
GROUP=com.daimajia.swipelayout

ANDROID_BUILD_MIN_SDK_VERSION=16
ANDROID_BUILD_TARGET_SDK_VERSION=25
ANDROID_BUILD_SDK_VERSION=25
ANDROID_BUILD_TOOLS_VERSION=25.0.2

同时将 demo / build.gradle 更改为:

dependencies {
    compile project(":library")
    compile 'com.android.support:recyclerview-v7:21.0.0'
    compile 'com.daimajia.easing:library:1.0.0@aar'
    compile 'com.daimajia.androidanimations:library:1.1.2@aar'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'jp.wasabeef:recyclerview-animators:1.0.3@aar'
}

最后更改 library / build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
    }
}

dependencies {
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:support-v4:25.+'
}
apply from: './gradle-mvn-push.gradle'

apply plugin: 'android-maven'
// build a jar with source files
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}
artifacts {
    archives sourcesJar
}

但我又得到了这个错误!

请帮帮我。

4 个答案:

答案 0 :(得分:3)

更改项目build.gradle文件的依赖关系

classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

这对我有用

答案 1 :(得分:0)

修改build.gradle文件

以下是一个例子:

No service of type Factory available in ProjectScopeServices

您需要包含maven成绩插件,如链接所示。

答案 2 :(得分:0)

选择正确版本的" android-maven-gradle-plugin",https://github.com/dcendents/android-maven-gradle-plugin

答案 3 :(得分:0)

在主项目build.gradle文件

中将gradle插件最新版本更改或包含在1.4.1中
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}

这对我有用......