ubuntu上Android项目首次运行失败,Error generating final archive: Failed to create key: Cannot run program

 Description Resource Path Location Type
Error generating final archive: Failed to create key: Cannot run program "/home/dongyunlong/java/jdk-8-sun/jre/bin/keytool": error=13, 权限不够
JAVA_HOME is set to: /home/dongyunlong/java/jdk-8-sun/jre
Update it if necessary, or manually execute the following command:

/home/dongyunlong/java/jdk-8-sun/jre/bin/keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore /home/dongyunlong/.android/debug.keystore -storepass androidA_fileOB UnknownAndroid Packaging Problem

从上述问题中发现Failed to create key, 就是缺少debug.keystore,我进入/home/dongyunlong/.android文件下,没有找到debug.keystore,上述中建议执行命令/home/dongyunlong/java/jdk-8-sun/jre/bin/keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore /home/dongyunlong/.android/debug.keystore -storepass androidA_fileOB 

进入root下执行上述指令,发现权限不够,上述错误中也有错误"error=13, 权限不够",所以先执行chmod 777 /home/dongyunlong/java/jdk-8-sun/jre/bin/keytool

所有命令执行完就会出现debug.keystore, 这时可能还有问题,删除debug.keystore再次新建项目运行就能够成功了.

ps: 1:可能不需要执行建议的命令,只需要提升keytool的权限就好了,执行建议命令会在文件夹下生成debug.keystore

     2:.android文件夹属于隐藏文件,在查看选项中选择显示隐藏文件

你可能感兴趣的:(ubuntu上Android项目首次运行失败,Error generating final archive: Failed to create key: Cannot run program)