I am trying to run a project in Android Studio on Ubuntu but it fails with the following error in gradle.
Error: Execution failed for task \':app:packageDebug\
Not sure if this totally applies, since you're running Ubuntu, but the same error on OSX was solved for me by changing the JRE that Android Studio was running under (following guidance from here: https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under)
I set the JRE version that Android Studio runs under to 1.7.* by changing this in the Info.plist file on OSX:
JVMVersion
1.7*
The version was confirmed in the "About" dialog. It changed from 1.6 to 1.7, and the BouncyCastle problem went away.