我试图在Android Studio中运行我的应用程序,但每次尝试时都会出现以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android:validateSigningDebug'.
> 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
在网上寻找解决方案并没有得到合适的结果。 使用--debug选项运行它会给我这个结果:
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] > 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
我正在使用的操作系统是Archlinux,.android文件夹的权限为:
$ ls -la
drwxr-xr-x 4 speedking speedking 4096 15 nov 11.59 .android
请问有人可以帮助我吗?
更新: 构建已签名的apk可以生效,但是在Android Studio中运行应用程序则不行。
使用--stacktrace运行它会输出以下信息:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android:validateSigningDebug'.
> 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.<init>(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
运行时加上 --stacktrace
来获取更详细的崩溃信息吗? - Dayan