Reputation: 368
My system: Windows 7, Android Studio V0.5.2, JDK V1.7.0_25
I've seen this discussed several different places but none of the solutions seem to work for me (or I haven't tried the right combination).
The problem is that when I build a project with Android studio and try to run it I get the error: **"Error:Gradle: Execution failed for task ':app:packageDebug'.
class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z"**
This seems to have something to do with the bouncy casstle dll's. I'm leary of changing things in my JDK to fix this - but i will if need be.
Does anyone have a definitive solution to this (and, will this be addressed by the Android Studio Team? Poking around and deleting dlls from a system can't be a good end solution).
Here's a list of all of the bc* files on my system:
C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext\bcprov-ext-jdk15on-1.46.jar
C:\Program Files\Java\jdk1.7.0_25\bin\bcprov-ext-jdk15on-1.46.jar
C:\Users\scott.coleman\Desktop\bcprov-ext-jdk15on-1.46.jar
C:\Program Files\Java\jre7\lib\ext\bcprov-ext-jdk15on-1.46.jar
C:\eclipse\configuration\org.eclipse.osgi\bundles\270\1\.cp\lib\bcprov-ext-jdk15on-148.jar
C:\Program Files\Charles\lib\bcprov-jdk14-143.jar
C:\Users\scott.coleman\AppData\Local\Temp\Rar$EXa0.979\gradle-1.10\lib\plugins\bcprov-jdk15-1.46.jar
C:\Users\scott.coleman\.gradle\wrapper\dists\gradle-1.10-all\1t6fjo8i1s1ddu1afn3ioaglko\gradle-1.10\lib\plugins\bcprov-jdk15-1.46.jar
C:\Users\scott.coleman\Desktop\bcprov-jdk15on-1.48.jar
C:\Android\android-sdk\tools\lib\bcprov-jdk15on-1.48.jar
C:\eclipse\configuration\org.eclipse.osgi\bundles\247\1\.cp\libs\bcprov-jdk15on-1.48.jar
C:\Program Files (x86)\Android\android-studio\plugins\android\lib\bcprov-jdk15on-1.48.jar
C:\Users\scott.coleman\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.48\960dea7c9181ba0b17e8bab0c06a43f0a5f04e65\bcprov-jdk15on-1.48.jar
Upvotes: 2
Views: 2979
Reputation: 1
I had this same one in Kubuntu. I switched my Java to Oracle version (1.8), clean up everything from Android Studio and Gradle. My new project still didn't work, so I tried import a old one, deal with new versions of plugins, and old project start working. I switched to new one, which throws this error and... is building without errors!
Upvotes: 0
Reputation: 1700
Today I uninstalled Android Studio Beta and installed the latest Android Studio release, when I tried to make a new project I received the same gradle error (Win7, Android Studio 1.0.2, JDK 1.7.0_75). First I tried replacing bcprov-jdk15on-1.48.jar but that didn't fix it for me. Then I tried the following:
Not sure which step solved it but I no longer receive the error and can run the application as expected.
Upvotes: 1
Reputation: 3369
Somehow, a broken library is being loaded in your jre. You can print out which jar is being loaded for the bouncycastle library and try deleting or replacing it.
Add the following snippet at the beginning of your build.gradle file
Class klass = org.bouncycastle.asn1.bc.BCObjectIdentifiers.class;
URL location = klass.getResource('/'+klass.getName().replace('.', '/')+".class");
println location.toURI().toString();
Upvotes: 0