欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android 中Failed to read key from keystore解决办法

程序员文章站 2023-12-14 22:36:58
android 中failed to read key from keystore解决办法 caused by: org.gradle.tooling.build...

android 中failed to read key from keystore解决办法

caused by: org.gradle.tooling.buildexception: failed to read key from keystore 
    at com.android.build.gradle.tasks.packageapplication.dofulltaskaction(packageapplication.groovy:110) 
    at com.android.build.gradle.internal.tasks.incrementaltask.taskaction(incrementaltask.groovy:64) 
    at org.gradle.internal.reflect.javamethod.invoke(javamethod.java:63) 
    at org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.doexecute(annotationprocessingtaskfactor 
y.java:235) 
    at org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.jav 
a:211) 
    at org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.execute(annotationprocessingtaskfactory. 
java:222) 
    at org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.jav 
a:200) 
    at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeaction(executeactionstaskexecuter.java:80) 
    at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:61) 
    ... 47 more 
caused by: com.android.builder.packaging.signingexception: failed to read key from keystore 
    at com.android.builder.core.androidbuilder.packageapk(androidbuilder.java:1468) 
    at com.android.builder.core.androidbuilder$packageapk$6.call(unknown source) 
    at com.android.build.gradle.tasks.packageapplication.dofulltaskaction(packageapplication.groovy:95) 
    ... 55 more 

build.gradle

signingconfigs { 
  robert { 
    storepassword 'robert' 
    storefile file('/users/bournewang/documents/project/android.keystore') 
    keypassword 'robert' 
    keyalias 'mike' 
  } 
} 


解决方案:

check your keystore file for first, in you example you creating file with 
name my-release-key.keystore. if its correct and really present in folder 
users/bournewang/documents/project check alias, in your example it is -alias alias_name,
 but in config you specified alias mike

大意是:

1.android.keystore可能不在指定目录下面

2.keyalias不对

另:想知道真正原因的话,可以查看

to find out what's wrong you can use gradle's singingreport command. 
 
on mac: 
 
./gradlew signingreport 
on windows: 
 
gradle signingreport 

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

上一篇:

下一篇: