我尝试启动一个 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
}
但是我又遇到了那个错误!
请帮助我。
最佳答案
更改项目build.gradle文件的依赖
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
这对我有用
关于安卓工作室 : No service of type Factory available in ProjectScopeServices,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42147856/