簡體   English   中英

我在android studio上遇到了奇怪的錯誤

[英]I am getting strange error on 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

settings.gradle

include ':app'
include ':libraries:HoloColorPicker-master'

的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')
}

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'

HoloColorPicker庫具有用於上載到Maven存儲庫的gradle任務,需要為gradle環境設置一些屬性(通常在gradle.properties )。

最簡單的解決方案是從build.gradle刪除該行:

apply from: 'maven_push.gradle'

我沒有嘗試myanimal給出的解決方案,但我嘗試了另一個適用於導入過程中具有類似問題的所有項目的東西。 myanimal的解決方案只與一個項目相關,對於每個項目,您都必須遵循同樣的事情。

但是使用我的解決方案,您可能只需要為所有未來的項目執行一次。

我的解決方案如下所示:

- 使用以下內容創建文件〜/ .gradle / gradle.properties:

 nexusUsername= nexusPassword= 

希望這對所有項目都有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM