New Android project not building if not signed.

I’m using Unity 2017.3.1p3.

Not able to build without signing the game.
If i try with debug key i get:

CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':packageRelease'.
> Failed to digitally sign signature file.

and internal:

CommandInvokationFailure: Failed to build apk.
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -Xmx2048M"/Users/joe/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

Error: Failed to seal APK

Signing the app with a keystore will allow me to build no issues.
Is there anything i can do to my android sdk?


I’m not 100% sure it’s related, but I had similar issue: Could not build with “Development build” flag, similar error.
The workaround was to install JDK below 8u91 (I used 8u77)