我在android studio上遇到了奇怪的错误

Ast*_*hme 17 android android-studio

请任何人帮助我.这是错误:错误:没有这样的属性:类的nexusUsername:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

堆栈跟踪

Information:Gradle tasks [:app:compileDebugJava]
Information:FAILURE: Build failed with an exception.
Information:* What went wrong:
Information:A problem occurred configuring project ':app'.
Information:> A problem occurred configuring project':libraries:HoloColorPicker-    master'.
Information:   > No such property: nexusUsername for class:        org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
       Information:* Try:
          Information:Run with --stacktrace option to get the stack trace. Run with --info                       or --debug option to get more log output.
Information:0 errors
Run Code Online (Sandbox Code Playgroud)

settings.gradle

include ':app'
include ':libraries:HoloColorPicker-master'
Run Code Online (Sandbox Code Playgroud)

的build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:19.+'
    compile project(':libraries:HoloColorPicker-master')
}
Run Code Online (Sandbox Code Playgroud)

Holopicker build.gradle

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

def isReleaseBuild() {
    return version.contains("SNAPSHOT") == false
}

allprojects {
    version = VERSION_NAME
    group = GROUP

    repositories {
        mavenCentral()
    }
}

apply plugin: 'android-library'
android {
    compileSdkVersion 19
    buildToolsVersion "18.1.1"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

apply from: 'maven_push.gradle'
Run Code Online (Sandbox Code Playgroud)

mya*_*mal 45

HoloColorPicker库具有用于上载到Maven存储库的gradle任务,该存储库需要为gradle环境(通常在gradle.properties)中设置一些属性.

最简单的解决方案是从build.gradle以下位置删除该行:

apply from: 'maven_push.gradle'
Run Code Online (Sandbox Code Playgroud)


Shr*_*jan 9

我没有尝试myanimal给出的解决方案,但我尝试了另一个适用于导入过程中具有类似问题的所有项目的东西.myanimal的解决方案只与一个项目相关,对于每个项目,您都必须遵循同样的事情.

但是使用我的解决方案,您可能只需要为所有未来的项目执行一次.

我的解决方案如下所示:

- 使用以下内容创建文件〜/ .gradle/gradle.properties:

nexusUsername=
nexusPassword=
Run Code Online (Sandbox Code Playgroud)

希望这对所有项目都有所帮助.