Can't create Activity or Fragment in Android Studio after updating to 4.0
Asked Answered
E

2

5

I have just changed my laptop and I opened the repo in which I was working. The problem is that I can't create a new Activity or a new Fragment because when I try to do so nothing happens. Nothing changes and nothing is created, but I don't get any error. I tried also to open this repo in a Linux PC within the command prompt and I discovered that when I create a new Activity the following logs appear in the console:

2020-06-18 21:31:21,287 [1773016]  ERROR - intellij.openapi.progress.Task - Could not extract certificate from file. 
java.lang.Exception: Could not extract certificate from file.
    at com.android.tools.idea.templates.KeystoreUtils.getCertificate(KeystoreUtils.kt:151)
    at com.android.tools.idea.templates.KeystoreUtils.sha1(KeystoreUtils.kt:122)
    at com.android.tools.idea.templates.KeystoreUtils.sha1$default(KeystoreUtils.kt:121)
    ...

Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:783)
    at com.android.tools.idea.templates.KeystoreUtils.getCertificate(KeystoreUtils.kt:143)
    ...
Caused by: java.security.UnrecoverableKeyException: Password verification failed
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:781)
    ... 27 more
2020-06-18 21:31:21,287 [1773016]  ERROR - intellij.openapi.progress.Task - Android Studio 4.0  Build #AI-193.6911.18.40.6514223 
2020-06-18 21:31:21,287 [1773016]  ERROR - intellij.openapi.progress.Task - JDK: 1.8.0_242-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2020-06-18 21:31:21,287 [1773016]  ERROR - intellij.openapi.progress.Task - OS: Linux 
2020-06-18 21:31:21,288 [1773017]  ERROR - intellij.openapi.progress.Task - Last Action: template.create.ActivityEmpty Activity 

I don't understand what is the correlation between a new activity and the keystore, but I tried even to create a new one but the error keeps appearing. The password is 100% correct. I don't know what to do. I can create new activities only on my old PC. The other coworkers seems to be fine with the same repo I use. I tried of course the common way to fix Android Studio like reboot, invalidate cache, clean, uninstall, etc... Thanks for your help.

EDIT

I figured out that this happens only when updating to Android Studio 4.0

EDIT 2

https://issuetracker.google.com/issues/159364425

Epaulet answered 18/6, 2020 at 19:42 Comment(0)
E
7

I think you have configuration debug signingConfigs

signingConfigs {
        debug {
            storeFile file('...')
            storePassword "..."
            keyAlias "..."
            keyPassword "..."
        }

}

1.delete debug signingConfigs

2.delete .idea and .gradle folders

3.rebuild project

I think this can solve your problem

Expectation answered 19/6, 2020 at 2:25 Comment(1)
Hi, thanks for your answer. After many tries I figured it out by myself commenting the signingConfig, but I still want to know why this happens. For now I'll accept your answer because it's the only fix that works, thanks again.Epaulet
W
1

have you tried this solution? Let me know if it works please.

  • close android studio
  • delete .idea and .gradle folders
  • open again your project with android studio

Or reinstall android studio?

Whoremaster answered 18/6, 2020 at 22:43 Comment(1)
Thanks, but the problem wasn't solved. I think it's an android studio problem, I have posted an issue to Google IssueTracker.Epaulet

© 2022 - 2024 — McMap. All rights reserved.