195

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?

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

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

Peter Reid
  • 4,169
  • 1
  • 33
  • 31
pallavi
  • 1,951
  • 2
  • 10
  • 3
  • Refer this links , https://groups.google.com/forum/?fromgroups#!topic/android-developers/1J7IFF_jPXQ , http://mortalpowers.com/news/android-development-error-incorrect-ava-format – rajeshwaran Aug 04 '12 at 11:48
  • And this: http://mortalpowers.com/news/android-development-error-incorrect-ava-format – tom_mai78101 Sep 10 '12 at 12:35
  • Can't google say "Invalid Character". Instead, they say "Incorret AVA format" Strip away any non alphanumeric characters, no accents and no weird letters. – Josh Apr 01 '14 at 07:17

10 Answers10

507

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

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

"+" (plus sign) sign also causes this issue. (People often tend to use + sign for the country code field)

Udara Seneviratne
  • 1,683
  • 1
  • 21
  • 40
rule
  • 5,157
  • 1
  • 12
  • 19
  • 23
    Just FYI, if you really want a comma in a field, you can escape it with a leading backslash, e.g. Acme\, Inc. See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html. This also works in the signing dialog of the Eclipse IDE. – Yojimbo Apr 30 '13 at 21:26
  • 1
    I found in code the list of characters that must be escaped ,+=<>#;" – Rafael Membrives Feb 14 '17 at 09:49
54

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.

Ratna Halder
  • 1,744
  • 15
  • 15
21

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:

  • Commas (,)
  • Addition symbol (+)
  • Quotation mark (")
  • Back-slash ("\")
  • Angled brackets(< and >)
  • Semi-colon (;)
surhidamatya
  • 1,603
  • 28
  • 53
9

I solved these Exception by changing the country code:

+91 to India

Steve
  • 9,114
  • 15
  • 82
  • 133
  • For this field you should be using the [iso 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) country code, in your case "IN" – PassKit Aug 30 '14 at 04:52
7

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)

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"
Patrick
  • 416
  • 3
  • 7
5

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 ... -dname="CN=SomeCertSubject" ...

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

galaxis
  • 785
  • 7
  • 9
  • not exact but was close enough for me. i put companyname inc. and the . (dot) of the inc caused a fail. – dcarl661 Aug 28 '20 at 20:58
4

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.

  • for me, the error was caused by comma between company name and llc. (thank you kingsley sithole). – tmr Oct 24 '14 at 17:18
2

It's a common mistake, when we're going to generate Signed APK in Android Studio. So in Keystore file you can't use any special character or symbol such as (, \ + - * / < > ; ' ") otherwise, you get java.io.IoException.

See a Demo, how can you fill-up your Keystore file:

Password: anything without special character or symbol

Alias: Key0 (up to you)

Validity (years): 25 (up to you)

First and last Name: Your proper Name but don't use special character in your name like $unny @dam

Organizational Unit: Your organization Name

Organization: Your organization Name

City or Locality: Your City Name

State or Province: Your State or Province Name

Country Code (XX): Use your country code, if you don't know then search Google.

Then click OK

Papel
  • 291
  • 2
  • 6
1

100% it will be worked.

Before you create the signed APK you must prepare your project.

  1. Add Flutter automation dependencies to your pubspec.yaml

dependencies:
flutter:
sdk: flutter
flutter_automation: ^1.1.4
Currently ^1.1.4 is the newest dependency, this will eventually change.

  1. Get the new dependency

Run flutter packages get in your command prompt in your projects directoy

  1. Setup the signing

Run flutter pub pub run flutter_automation --android-signin your command prompt.Then you will be asked to input

then you can give below code. it below code work 100%. ( if you want to change. you can do. ) enter key alias:

omor4flutter

enter dname as (CN=popupbits.com, OU=DD, O=Popup Bits Ltd., L=Kathmandu, S=Bagmati, C=NP):

 CN=popupbits.com, OU=DD, O=Popup Bits Ltd., L=Kathmandu, S=Bagmati, C=NP

key password:

 omor4flutter

keystore password:

 omor4flutter
  1. Generate your signed apk or bundle

Simply run flutter build apk --release or flutter build bundle --release to generate a signed apk/bundle of your app.

1

I made a mistake by entering + in the front of the country code. so changed the values like below.

+7 to 7

it works for me.

Ajay Kumar
  • 51
  • 1
  • 4