title: Android Studio Build of App fails claiming Keystore was tampered with
body: <p>I have recently ported an Android app from Eclipse to Android Studio. I was able to debug the application and I've even been able to build a release version for the client to test with. Unfortunately, I can not debug anymore. When I try to run the app from Android Studio it fails. (See logcat and monitor output below.)</p>
  
  <p>As far as I know, I haven't changed the keystore. I only just created it 5 days ago. So I'm wondering where to go from here. This app has already been down for several weeks while I've been porting to Android Studio and I've got more work to do to get it functional again. (Client updated to Android 7 all at once. Ack!)</p>
  
  <p>I humbly ask for any help you can give me. Thank you, Ray.</p>
  
  <p>P.S.: Could antivirus or autobackup have anything to do with this?</p>
  
  <p>Logcat Output:</p>
  
  <pre><code>Gradle tasks [:app:assembleDebug]
  Error:java.io.IOException: Keystore was tampered with, or password was incorrect
  Error:java.security.UnrecoverableKeyException: Password verification failed
  Error:Execution failed for task ':app:transformDexWithInstantRunDependenciesApkForDebug'.
  &gt; com.android.build.api.transform.TransformException: com.android.ide.common.signing.KeytoolException: Failed to read key MyAndroidKey from store "I:\Users\Ray\keystores\android.jks": Keystore was tampered with, or password was incorrect
  </code></pre>
  
  <p>And in the monitor I get:</p>
  
  <pre><code>Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
  :app:buildInfoDebugLoader
  :app:preBuild UP-TO-DATE
  :app:preDebugBuild UP-TO-DATE
  :app:compileDebugAidl UP-TO-DATE
  :app:compileDebugRenderscript UP-TO-DATE
  :app:checkDebugManifest UP-TO-DATE
  :app:generateDebugBuildConfig UP-TO-DATE
  :app:prepareLintJar UP-TO-DATE
  :app:generateDebugResValues UP-TO-DATE
  :app:generateDebugResources UP-TO-DATE
  :app:mergeDebugResources UP-TO-DATE
  :app:createDebugCompatibleScreenManifests UP-TO-DATE
  :app:processDebugManifest
  :app:splitsDiscoveryTaskDebug UP-TO-DATE
  :app:processDebugResources
  :app:generateDebugSources
  :app:javaPreCompileDebug UP-TO-DATE
  :app:compileDebugJavaWithJavac UP-TO-DATE
  :app:mergeDebugShaders UP-TO-DATE
  :app:compileDebugShaders UP-TO-DATE
  :app:generateDebugAssets UP-TO-DATE
  :app:mergeDebugAssets UP-TO-DATE
  :app:packageInstantRunResourcesDebug UP-TO-DATE
  :app:checkManifestChangesDebug
  :app:transformClassesWithExtractJarsForDebug UP-TO-DATE
  :app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE
  :app:transformClassesWithDependencyCheckerForDebug UP-TO-DATE
  :app:compileDebugNdk NO-SOURCE
  :app:mergeDebugJniLibFolders UP-TO-DATE
  :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
  :app:processDebugJavaRes NO-SOURCE
  :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
  :app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug UP-TO-DATE
  :app:transformClassesWithInstantRunForDebug UP-TO-DATE
  :app:transformClassesEnhancedWithInstantReloadDexForDebug UP-TO-DATE
  :app:incrementalDebugTasks UP-TO-DATE
  :app:preColdswapDebug
  :app:fastDeployDebugExtractor UP-TO-DATE
  :app:generateDebugInstantRunAppInfo UP-TO-DATE
  :app:transformClassesWithInstantRunSlicerForDebug UP-TO-DATE
  :app:transformClassesWithDexBuilderForDebug
  :app:transformDexArchiveWithExternalLibsDexMergerForDebug
  :app:transformDexArchiveWithDexMergerForDebug
  :app:validateSigningDebug
  :app:transformDexWithInstantRunDependenciesApkForDebug
  Error while generating dependencies split APK
  com.android.ide.common.signing.KeytoolException: Failed to read key MyAndroidKey from store "I:\Users\Ray\keystores\android.jks": Keystore was tampered with, or password was incorrect
      at com.android.ide.common.signing.KeystoreHelper.getCertificateInfo(KeystoreHelper.java:212)
      at com.android.builder.core.AndroidBuilder.packageCodeSplitApk(AndroidBuilder.java:1393)
      at com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApk(InstantRunSplitApkBuilder.java:174)
      at com.android.build.gradle.internal.transforms.InstantRunDependenciesApkBuilder.transform(InstantRunDependenciesApkBuilder.java:139)
      at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
      at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
      at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
      at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
      at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
      at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
      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.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)
      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 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
      at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:780)
      at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56)
      at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:224)
      at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
      at java.security.KeyStore.load(KeyStore.java:1445)
      at com.android.ide.common.signing.KeystoreHelper.getCertificateInfo(KeystoreHelper.java:190)
      ... 51 more
  Caused by: java.security.UnrecoverableKeyException: Password verification failed
      at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:778)
      ... 56 more
  
   FAILED
  :app:buildInfoGeneratorDebug
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:transformDexWithInstantRunDependenciesApkForDebug'.
  &gt; com.android.build.api.transform.TransformException: com.android.ide.common.signing.KeytoolException: Failed to read key MyAndroidKey from store "I:\Users\Ray\keystores\android.jks": Keystore was tampered with, or password was incorrect
  
  * 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 11s
  
  39 actionable tasks: 11 executed, 28 up-to-date
  </code></pre>