【问题标题】:android studio: No service of type Factory available in ProjectScopeServicesandroid studio:ProjectScopeServices 中没有工厂类型的服务可用
【发布时间】:2017-06-28 02:54:33
【问题描述】:

我尝试创建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 version: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
}

但我又遇到了那个错误!

请帮帮我。

【问题讨论】:

标签: android android-studio


【解决方案1】:

改变项目build.gradle文件的依赖

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

这对我有用

【讨论】:

    【解决方案2】:

    修改你的 build.gradle 文件

    这是一个例子:

    No service of type Factory available in ProjectScopeServices

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 那么正确的版本是什么? OP在哪里设置这个版本?
      【解决方案4】:

      在您的主项目 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'
      }
      

      这对我有用...

      【讨论】:

        【解决方案5】:

        ProjectScopeServices 中没有可用的工厂类型服务

        您应该在 PROJECT 级别使用以下 build.gradle

        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
        

        并在您的 APP 级别 build.gradle 中包含 apply plugin 标记。

        apply plugin: 'com.github.dcendents.android-maven'
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-02-11
          • 2018-03-30
          • 1970-01-01
          • 2019-05-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多