Basic authentication on Android Gradle [beginner]

Asked

Viewed 16 times

-1

I am an intern. I have an android project, I am in build.Radle, my superior said that for security purposes I could not edit the project (source code) to enter my authentication, I should find a way for Gradle to use these variables ${nomUser}, run on my machine.

We use the Nexus (Sonotype) to which the link https://libs.mycompany.com.br/repository/mycompany-app-release/ will consult for authentication, if I could edit I could, but I don’t know how I can do it by Gradle without editing source code, I suspect I must make a script, but I’m not sure.

Only using username = "${nameUser}" password = "${nomPassword}, error "Could not get Unknown Property 'nomUser' for credentials [username: null] of type org.gradle.Internal.credentials.Defaultpasswordcredential

I watched more than 15 videos on the Internet attentively about what Gradle is, how it works, but none dealt with credentials, in the documentation I could not see anything direct to my problem, I had some insights like looking for Settings.Radle in folder C://Radle, but I dismissed it because it didn’t even exist there, soon I realized that it is far from reality, I am starting to program now.

allprojects {
      repositories {
         google()
         jcenter()
         maven { url 'https://maven.google.com/' }
         maven { url "https://jitpack.io" }
         maven { url 'https://maven.fabric.io/public'}
         maven {
               credentials {
                          username = "${nomUser}"
                          password = "${nomPassword}"
                          }
               url 'https://libs.mycompany.com.br/repository/mycompany-app-release/'
               authentication {
                    basic(BasicAuthentication)
               }}
         maven { url 'http://sales.mycompany.github.io/AAAA-SDK-Android/repository' }
     }
}

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.