plaid icon indicating copy to clipboard operation
plaid copied to clipboard

After cloning build fails

Open eothein opened this issue 4 years ago • 15 comments

After a clean clone I get the following error while building:

Gradle Sync Issues
build.gradle :
ERROR: For input string: "" 

When opening the file it mentions:

ext {
    // query git for the commit count to automate versioning.
    gitCommitCount = 100 +
            Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
}

But I do not see the issue?

eothein avatar Dec 04 '19 11:12 eothein

I cannot reproduce this on master. Can you provide some additional information (AGP version, host OS, branch)?

What result do you get if you manually run the git command from plaid root folder?

git rev-list --count HEAD

pfmaggi avatar Dec 04 '19 11:12 pfmaggi

I'm seeing this issue as well at plaid/build.gradle: line 76

ERROR: For input string: ""

I'm using Android Studio 4.0 Preview though, so maybe it's that.

jaysondc avatar Dec 05 '19 23:12 jaysondc

On which OS are you seeing this? I cannot reproduce it on Linux with Android Studio v4.0-canary05, Android Gradle Plugin v4.0.0-alpha05, and Gradle 6.1-milestone1.

pfmaggi avatar Dec 06 '19 11:12 pfmaggi

OS: MacOS Mojave 10.14.5 IDE: Android Studio 4.0 Canary 1 Gradle Wrapper: 5.6.1 Gradle Plugin: 4.0.0-alpha01

jaysondc avatar Dec 06 '19 17:12 jaysondc

Thanks for the info. Can you trying it again with Canary 5 (that's the version I've used). if you cannot install a new version of Android Studio, you can just try from the command line with the Android Gradle Plugin v4.0.0-canary05.

Pietro Maggi | Android Developer Advocate | [email protected] |

On Fri, Dec 6, 2019 at 5:42 PM Jayson Dela Cruz [email protected] wrote:

OS: MacOS Mojave 10.14.5 IDE: Android Studio 4.0 Canary 1 Gradle Wrapper: 5.6.1 Gradle Plugin: 4.0.0-alpha01

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/android/plaid/issues/798?email_source=notifications&email_token=AABODVW2B6MOTEVG3R3SOJLQXKFINA5CNFSM4JVHBBB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGE2RVI#issuecomment-562669781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABODVS4RFEU6JBCREXYMADQXKFINANCNFSM4JVHBBBQ .

pfmaggi avatar Dec 06 '19 18:12 pfmaggi

Dear @pfmaggi

Running git rev-list --count HEADresults in 1246 so it is not an empty string.

  • I'm running macOS Mojave, version 10.14.5
  • Android Studio 3.5.2
  • Gradle Plugin Version 3.6.0-beta03
  • Gradle Version 5.6.1

Should the project not be able to be build, independent of the versions used?

eothein avatar Dec 09 '19 08:12 eothein

Should the project not be able to be build, independent of the versions used?

Yes, absolutely. But I cannot reproduce this problem on my Linux machine. :man_shrugging: I'll see if someone else running Mojave can test this.

pfmaggi avatar Dec 09 '19 10:12 pfmaggi

I commented out the code, i.e.

ext {
    // query git for the commit count to automate versioning.
    gitCommitCount = 100
//            Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
}

to try to debug, but then I get the following error:

This version of Android Studio cannot open this project, please retry with Android Studio 3.6 or newer.

Checking the site of Android Studio, I see that the latest version is 3.5.3, which is the one I have ...

eothein avatar Dec 09 '19 12:12 eothein

Android Studio v3.6 is still in Beta and can be downloaded from the preview page.

Also, you can build directly from the command line, independently of which Android Studio version you have using (from the directory where the sources are):

./gradlew assemble

you can run

./gradlew tasks

to see a complete list of the available commands.

pfmaggi avatar Dec 09 '19 13:12 pfmaggi

I changed the gradle tools version to the latest official release 3.5.0 so I don't need to update to a Beta version.

But the

ext {
    // query git for the commit count to automate versioning.
    gitCommitCount = 100+
            Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
}

Is still failing.

eothein avatar Dec 10 '19 16:12 eothein

What helped me building plaid was to get rid of gitCommitCount and set version code manually. I also had an issue with a ClientAuthInterceptor class:

val url = chain.request().url.newBuilder()

where url is package private, so I had to use a public url method. So far seems to be working just fine:

val url = chain.request().url().newBuilder()

Micpol avatar Dec 11 '19 08:12 Micpol

I did the same thing for the gitCommitCount issue, but this should be addressed in the codebase, so that whenever somebody clones the project he can build it without issues.

De ClientAuthInterceptor problem I faced too, and your solution resolved it. PR and merge in the codebase?

eothein avatar Dec 11 '19 08:12 eothein

Could it be a git issue? Mac bundles some outdated version and, I assume, people on Linux are updating git constantly.

emartynov avatar Jan 08 '20 09:01 emartynov

I had the same issue on Catalina.

  • macOS Catalina, version 10.15.3
  • Android Studio 3.6.1
  • Gradle Plugin Version 3.6.0
  • Gradle Version 5.6.4

I managed to fix it by pass null as the first parameter to the execute command. It works on Windows too with the null parameter. I couldn't test on Linux.
It also works on macOS if you call the execute command without any parameters but I didn't test this on any other platform.

gitCommitCount = 100 + 
        Integer.parseInt('git rev-list --count HEAD'.execute(null, project.rootDir).text.trim())

csabapap avatar Mar 10 '20 10:03 csabapap

I had the same issue on Catalina. i managed to fix it by removing both the params from the execute() function.

gitCommitCount = 100 +
         Integer.parseInt('git rev-list --count HEAD'.execute().text.trim())

udhay24 avatar Jun 03 '20 12:06 udhay24