Android keytool 错误:java.io.IoException:不正确的 AVA 格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11808391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:55:56  来源:igfitidea点击:

keytool error :java.io.IoException:Incorrect AVA format

androidandroid-keystore

提问by pallavi

I am new to Android development; when I have been trying to sign the application I have got the following error. Can anyone help me on this issue?

我是 Android 开发新手;当我尝试签署应用程序时,出现以下错误。任何人都可以帮助我解决这个问题吗?

keytool error :java.io.IoException:Incorrect AVA format

I have found some solution on the forums, for instance I need to run the debug.keystorebut I was not successful.

我在论坛上找到了一些解决方案,例如我需要运行debug.keystore但我没有成功。

回答by rule

Probably you entered illegal character(something like ,(comma)) in a field for Name, Organization or somewhere else.

可能您在名称、组织或其他位置的字段中输入了非法字符(类似 ,(逗号))。

Of course if you really want some charachter can be escaped with \ sign

当然,如果你真的想要一些字符可以用 \ 符号转义

回答by Ratna Halder

I have faced an error while trying to export a signed .apk file with Eclipse ADT. The error was same like your error. In my case, I used a + sign before the country code. By removing the + sign from this name fixed the problem and allowed me to fully export my signed .apk file. Also, this error can occur when use comma,slash, semi-colon, quotation.

我在尝试使用 Eclipse ADT 导出已签名的 .apk 文件时遇到错误。该错误与您的错误相同。就我而言,我在国家/地区代码前使用了 + 号。通过从此名称中删除 + 号解决了问题,并允许我完全导出已签名的 .apk 文件。此外,使用逗号、斜线、分号、引号时可能会发生此错误。

回答by surhidamatya

You tried to use special characters while exporting apk.You can't use these special characters in any field shown while creating the apk. The special character set includes:

您在导出 apk 时尝试使用特殊字符。您不能在创建 apk 时显示的任何字段中使用这些特殊字符。特殊字符集包括:

  • Commas (,)
  • Addition symbol (+)
  • Quotation mark (")
  • Back-slash ("\")
  • Angled brackets(< and >)
  • Semi-colon (;)
  • 逗号 (,)
  • 加号 (+)
  • 引号 (")
  • 反斜杠(“\”)
  • 尖括号(<和>)
  • 分号 (;)

回答by Steve

I solved these Exception by changing the country code:

我通过更改国家/地区代码解决了这些异常:

+91to India

+91India

回答by Patrick

I came on this error when I did not set the distinguished name option at all. This was corrected by setting the option to a validly formatted string.

当我根本没有设置专有名称选项时,我遇到了这个错误。这已通过将选项设置为有效格式的字符串来更正。

this command failed with the AVA format exception: (line breaks added for legibility)

此命令因 AVA 格式异常而失败:(为易读性添加了换行符)

C:\Program Files\Java\jdk1.6.0_45\jre\bin>keytool 
-genkey -v -dname PatrickTaylor -validity 10000 
-keystore C:\drops\patrickkeystore 

this command completed successfully:

此命令成功完成:

C:\Program Files\Java\jdk1.6.0_45\jre\bin>keytool 
-genkey -v -dname PatrickTaylor -validity 10000 
-keystore C:\drops\patrickkeystore 
-dname "cn=Patrick Taylor, ou=engineering, o=company, c=US"

回答by kingsley sithole

this "Probably you entered illegal character(something like ,(comma)) in a field for Name, Organization or somewhere else. " worked for me. I had a comma on the state or province. please mark this answer by rule as the answer; as + in +91 is a special character.

这个“可能你在名称、组织或其他地方的字段中输入了非法字符(比如,(逗号))。”对我有用。我对州或省有一个逗号。请按规则将此答案标记为答案;as + in +91 是一个特殊字符。

回答by user1172173

Special chars/escaping all good answers/could be the problem; you didn't share your actual "keytool" command line so harder to give an accurate answer. If you're trying to gen a pub/priv key pair ("-genkeypair" param), then 1 problem would be that the cert subject distinguished name ("-dname" arg) wasn't specified in the correct X.500 AVA ("Attribute-Value-Assertion") format. For example, omitting the "CN=" in front of the subject common name (CN). Param should look something like this:

特殊字符/转义所有好的答案/可能是问题所在;你没有分享你的实际“keytool”命令行,所以很难给出准确的答案。如果您正在尝试生成一个 pub/priv 密钥对(“-genkeypair”参数),那么 1 个问题是证书主题专有名称(“ -dname”arg)未在正确的 X.500 AVA 中指定( “ttribute- Value-ssertion”)格式。例如,省略主题通用名 (CN) 前的“CN=”。参数应该是这样的:

keytool ... -dname="CN=SomeCertSubject" ...

In this distinguished name param, "CN" ("Common Name") is the "Attribute", "SomeCertSubject" is the "Value".

在这一专有名称PARAM,“ CN”(“通用名称”)是“一个ttribute”,“ SomeCertSubject”是“ VALUE”。

回答by Josh

Can't google say "Invalid Character". Instead, they say "Incorret AVA format" Strip away any non alphanumeric characters, no accents and no weird letters.

谷歌不能说“无效字符”。相反,他们说“Incorret AVA 格式”去掉任何非字母数字字符,没有重音和奇怪的字母。