ProjectScopeServices gradle sync问题中没有类型工厂的服务

时间:2016-10-03 05:21:56

标签: android android-gradle build.gradle

嗨,这是我的gradle无法建立项目

 apply plugin: 'com.android.application'

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/ASL2.0'
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }


    defaultConfig {
        applicationId "com.smartgallery.graymatics.vf_smart_gallery"
        multiDexEnabled true
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 150020104
        versionName "2.1.04"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile files('libs/universal-image-loader-1.9.3-with-sources.jar')

    compile project(':graymatics')
    compile files('libs/httpclient-4.0.3.jar')
    compile files('libs/httpcore-4.0.1.jar')
    compile project(':FFmpegAndroid')
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.google.android.gms:play-services-plus:7.5.0'
    compile 'com.google.android.gms:play-services-appinvite:7.5.0'
    compile 'com.crittercism:crittercism-android-agent:5.6.3-rc-1'
    compile 'com.getbase:floatingactionbutton:1.10.0'
    compile 'com.github.jorgecastilloprz:fillableloaders:1.03@aar'
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

Logcat:

Caused by: org.gradle.internal.service.UnknownServiceException: No service of type Factory<LoggingManagerInternal> available in ProjectScopeServices.
caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AndroidMavenPlugin'.
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.github.dcendents.android-maven']

这是其他模块gradle

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

// This is the library version used when deploying the artifact
version = VERSION_NAME

android {
    compileSdkVersion rootProject.ext.compileSdkVersion as Integer
    buildToolsVersion rootProject.ext.buildToolsVersion as String

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion as Integer
        targetSdkVersion rootProject.ext.targetSdkVersion as Integer
        versionCode rootProject.ext.versionCode as Integer
        versionName rootProject.ext.versionName as String
    }

    sourceSets.main {
        assets.srcDirs = ['assets']
        jni.srcDirs = [] //disable automatic ndk-build
        jniLibs.srcDirs = ['libs']
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0'
}

group = GROUP

install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging POM_PACKAGING

                // Add your description here
                name 'FFmpeg Android'
                description = POM_DESCRIPTION
                url POM_URL

                // Set your license
                licenses {
                    license {
                        name POM_LICENCE_NAME
                        url POM_LICENCE_URL
                    }
                }
                developers {
                    developer {
                        id POM_DEVELOPER_ID
                        name POM_DEVELOPER_NAME
                        email 'hitesh@writingminds.com'
                    }
                }
                scm {
                    connection POM_SCM_URL
                    developerConnection POM_SCM_URL
                    url POM_URL

                }
            }
        }
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}
artifacts {
    archives javadocJar
    archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

// https://github.com/bintray/gradle-bintray-plugin
bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']
    pkg {
        repo = "maven"
        // it is the name that appears in bintray when logged
        name = "ffmpeg-android"
        websiteUrl = POM_URL
        vcsUrl = POM_SCM_URL
        licenses = ["GPL-3.0"]
        publish = true
        version {
            gpg {
                sign = true
                passphrase = properties.getProperty("bintray.gpg.password")
            }
            mavenCentralSync {
                sync = true
                user = properties.getProperty("bintray.oss.user") //OSS user token
                password = properties.getProperty("bintray.oss.password") //OSS user password
                close = '1'
            }
        }
    }
}

2 个答案:

答案 0 :(得分:24)

通过在build.gradle中更新以下内容获得它

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

答案 1 :(得分:0)

# Version of Gradle

1: -

classpath&#39; com.android.tools.build:gradle:2.2.0&#39;

classpath&#39; com.github.dcendents:android-maven-gradle-plugin:1.4.1&#39;

2: -

classpath&#39; com.android.tools.build:gradle:2.2.0-beta1&#39;

classpath&#39; com.github.dcendents:android-maven-gradle-plugin:1.3&#39;