Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not get unknown property 'mavenUser' for Credentials

All I am getting following error in build.gradle in Android Studio :

Could not get unknown property 'mavenUser' for Credentials
        [username: null] of type
org.gradle.api.internal.artifacts.repositories.DefaultPasswordCredentials_Decorated

Below my Gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'

        repositories {
            mavenCentral()
            maven {


                // ~/.gradle/gradle.properties should be configured!
                credentials {
                    username mavenUser
                    password mavenPassword
                }
                url 'http://dev.softwerk.se:8080/nexus/content/repositories/softwerk-repo'
            }
        }

        android {
            compileSdkVersion 19
            buildToolsVersion "19.0.1"

            defaultConfig {
                minSdkVersion 8
                targetSdkVersion 19
                versionCode 2014020601
                versionName "2.0.0"
            }

            compileOptions {
                sourceCompatibility JavaVersion.VERSION_1_7
                targetCompatibility JavaVersion.VERSION_1_7
            }
        }

        dependencies {
            compile 'com.android.support:support-v4:19.0.+'
            compile 'com.android.support:appcompat-v7:19.0.+'
            compile 'com.google.android.gms:play-services:4.0.30'

            // Sync framework
            compile 'se.softwerk.commons.android:android-framework:1.1.10@aar'
            compile 'com.googlecode.plist:dd-plist:1.0'
            compile 'com.google.code.gson:gson:1.7.1'
            compile 'commons-io:commons-io:2.1'
        }
    }
}`
like image 229
Yodgorbek Komilov Avatar asked Dec 17 '16 17:12

Yodgorbek Komilov


People also ask

Where do I put Gradle credentials?

Username and password should never be checked in plain text into version control as part of your build file. You can store the credentials in a local gradle. properties file and use one of the open source Gradle plugins for encrypting and consuming credentials e.g. the credentials plugin.


2 Answers

Create a file called gradle.properties in your project directory. Add the lines:

mavenUser=yourusername
mavenPassword=yourpassword
like image 150
rm8x Avatar answered Sep 20 '22 08:09

rm8x


  1. For me it works I have add this official doc generated username and password in settings.gradle file under mavenCentral() write this username and password with proper use of = ' '

    for first change

    username='paypal_sgerritz'
    password='AKCp8jQ8tAahqpT5JjZ4FRP2mW7GMoFZ674kGqHmupTesKeAY2G8NcmPKLuTxTGkKjDLRzDUQ'
    
  2. Add this username and password in gradle.properties file with proper use of = ' '

    username='paypal_sgerritz'
    password='AKCp8jQ8tAahqpT5JjZ4FRP2mW7GMoFZ674kGqHmupTesKeAY2G8NcmPKLuTxTGkKjDLRzDUQ'
    
like image 28
The Sun Avatar answered Sep 19 '22 08:09

The Sun