title: Android Studio - Failed to create keystore
body: <p>I'm trying to run my app from inside Android Studio, but every time I try i get this error:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':android:validateSigningDebug'.
  &gt; java.util.concurrent.ExecutionException: 
  com.android.builder.utils.SynchronizedFile$ActionExecutionException: 
  com.android.ide.common.signing.KeytoolException: Failed to create 
  keystore.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 2s
  </code></pre>
  
  <p>Searching for a solution online did not lead me to a suitable one.
  Running it with the --debug option gives me this result:    </p>
  
  <pre><code>15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':android:validateSigningDebug'.
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] &gt; java.util.concurrent.ExecutionException: com.android.builder.utils.SynchronizedFile$ActionExecutionException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  15:21:41.278 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
  15:21:41.279 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2s
  </code></pre>
  
  <p>The OS I'm using is Archlinux and the permissions for the .android folder are:</p>
  
  <pre><code>$ ls -la
  drwxr-xr-x  4 speedking speedking    4096 15 nov 11.59 .android
  </code></pre>
  
  <p>Can anyone help me please?</p>
  
  <p>Edit:
  Building a signed apk does work, just running the app from Android Studio doesn't.</p>
  
  <p>Running it with --stacktrace outputs this:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':android:validateSigningDebug'.
  &gt; java.util.concurrent.ExecutionException: com.android.builder.utils.SynchronizedFile$ActionExecutionException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  
  * Try:
  Run with --info or --debug option to get more log output.
  
  * Exception is:
  org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:validateSigningDebug'.
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
  at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
  at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
  at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
  at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
  at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
  at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
  at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
  at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
  at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
  at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
  at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
  at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
  at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
  at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
  Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.utils.SynchronizedFile$ActionExecutionException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
  at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
  at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
  at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
  at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
  ... 27 more
  Caused by: java.util.concurrent.ExecutionException: com.android.builder.utils.SynchronizedFile$ActionExecutionException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  at com.android.builder.utils.SynchronizedFile.doActionWithMultiProcessLocking(SynchronizedFile.java:267)
  at com.android.builder.utils.SynchronizedFile.write(SynchronizedFile.java:232)
  at com.android.builder.utils.SynchronizedFile.createIfAbsent(SynchronizedFile.java:328)
  at com.android.build.gradle.internal.tasks.ValidateSigningTask.validate(ValidateSigningTask.java:90)
  at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
  ... 39 more
  Caused by: com.android.builder.utils.SynchronizedFile$ActionExecutionException: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  at com.android.builder.utils.SynchronizedFile.lambda$createIfAbsent$0(SynchronizedFile.java:336)
  at com.android.builder.utils.SynchronizedFile.doActionWithMultiProcessLocking(SynchronizedFile.java:265)
  ... 43 more
  Caused by: com.android.ide.common.signing.KeytoolException: Failed to create keystore.
  at com.android.ide.common.signing.KeystoreHelper.createNewStore(KeystoreHelper.java:158)
  at com.android.ide.common.signing.KeystoreHelper.createDebugStore(KeystoreHelper.java:105)
  at com.android.build.gradle.internal.tasks.ValidateSigningTask.lambda$validate$0(ValidateSigningTask.java:111)
  at com.android.builder.utils.SynchronizedFile.lambda$createIfAbsent$0(SynchronizedFile.java:334)
  ... 44 more
  Caused by: java.lang.SecurityException: class "org.bouncycastle.jcajce.provider.symmetric.IDEA$Mappings"'s signer information does not match signer information of other classes in the same package
  at org.bouncycastle.jce.provider.BouncyCastleProvider.loadAlgorithms(Unknown Source)
  at org.bouncycastle.jce.provider.BouncyCastleProvider.setup(Unknown Source)
  at org.bouncycastle.jce.provider.BouncyCastleProvider.access$000(Unknown Source)
  at org.bouncycastle.jce.provider.BouncyCastleProvider$1.run(Unknown Source)
  at org.bouncycastle.jce.provider.BouncyCastleProvider.&lt;init&gt;(Unknown Source)
  at com.android.ide.common.signing.KeystoreHelper.generateKeyAndCertificate(KeystoreHelper.java:254)
  at com.android.ide.common.signing.KeystoreHelper.createNewStore(KeystoreHelper.java:143)
  ... 47 more
  
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 1s
  </code></pre>