com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store

error message

After the program build is successful, when the simulator is opened to run the app, the following error occurs. Unable to read debug.keystore from the default storage location because it is locked by the process. The solution is to delete the path mentioned in the error report debug.keystoreand debug.keystore.locka new debug.keystore will be regenerated when the emulator is running.

Execution failed for task ':app:packageDebug'. 
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.ide.common.signing.KeytoolException: 
Failed to read key AndroidDebugKey from store "C:\Users\FASHION\.android\debug.keystore": 
Invalid keystore format
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "C:\Users\������������\.android\debug.keystore": Invalid keystore format

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageDebug'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.tooling.BuildException: 1 exception was raised by workers:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
	... 34 more
Caused by: com.android.ide.common.workers.WorkerExecutorException: 1 exception was raised by workers:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
	at com.android.build.gradle.internal.tasks.Workers$WorkerExecutorAdapter.await(Workers.kt:297)
	at com.android.build.gradle.internal.scope.BuildElements$WorkersBasedScheduler$transform$2.call(BuildElements.kt:169)
	... 95 more
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.build.gradle.internal.packaging.IncrementalPackagerBuilder.withSigning(IncrementalPackagerBuilder.java:260)
	... 29 more
Caused by: java.io.IOException: Invalid keystore format
	at com.android.ide.common.signing.KeystoreHelper.getCertificateInfo(KeystoreHelper.java:187)
	... 30 more
Solution

1. Close AS, open C:\Users\用户名\.androidthe directory, find the following two files and delete them.

insert image description here

2. When deleting, it may prompt debug.keystorethat the file has been opened by Java, so we click Cancel.

insert image description here

3. Ctrl + Shift + EscOpen the task manager, find Java(TM)Platform SE binarythe process named , and end the process.

insert image description here

4. Delete the debug.keystore that was not deleted just now. Then restart the AS and run the app successfully.

insert image description here

Sheep have the grace of kneeling and breastfeeding, and crows have the righteousness of feeding back. Gratitude and filial piety are the foundation of being a human being.

Guess you like

Origin blog.csdn.net/qq_42257666/article/details/129538154