1

What is the best way to generate an apk file to submit my app to Amazon using Eclipse?

I tried using the Android Tools -> Export Unsigned Application Package... But when I email the apk to my Kindle Fire and try to install it, the install fails with "Application failed to install"

If I grab the apk that eclipse generates in the bin folder and email it to myself, then it installs fine in the Kindle, but this is a debug build.

I would like to produce a release build that will be the one I submit to Amazon and that I can also install wirelessly to my Kindle for testing. I would like to test the same build I submit to Amazon. But I don't know how to generate the build to submit to Amazon either.

Thanks!

mikemeli
  • 727
  • 11
  • 24

3 Answers3

3

You have yo sign your APK to install it.If you want to submit it you should generate a key the APK and sign it properly.

if you want to 'test it' on the device you can send the APK located at your /bin/ folder which is automatically signed with a debug sign

Kirill Kulakov
  • 9,714
  • 9
  • 48
  • 65
  • So, to generate an apk to submit to Amazon is the same as for google? I need to use a keystore and use the Export feature in Eclipse??? I thought I read somewhere that Amazon signs the apk for you. – mikemeli Nov 26 '12 at 20:52
  • I tried emailing to myself the signed apk using export feature in eclipse to the kindle, and it installed fined (had to uninstalled the previous debug version of course). So I assume I have to submit to Amazon the signed api. – mikemeli Nov 26 '12 at 20:58
  • Have't heard of that, but it sound preposterous that you have to relay on Amazon to sign your apk while you might want to test it before uploading it when it signed. – Kirill Kulakov Nov 26 '12 at 20:59
0

Amazon must put their DRM module into the APK file; therefore, you must sign it after that because writing anything in a signed APK file will invalidate the signature. The following link describe in detail how to manually sign your APK file:

http://developer.android.com/tools/publishing/app-signing.html

To clarify the case with Amazon:

1- Export an unsigned APK file using Eclipse and send this file to Amazon in order for them to put their DRM into it.

2- Create a certificate using the keytool utility as explained in the step 1 of the reference. (You must use a command shell (cmd) for this. Don't forget to set up the correct path for keytool.exe. It should be located in the bin repertory of your java sdk; like "C:\Program Files (x86)\Java\jdk1.6.0_27\bin" ).

Instead of creating a new one, you can also reuse the certificate created by Eclipse when you export a signed application.

Don't forget that you'll have to reuse the same certificate for creating an upgrade; so don't forget the various passwords!

3- You must then sign your APK (as modified by Amazon) using the jarsigner tool and after that, you must align it using the zipalign tool; as explained in the reference. Contrary to the two other tools, the zipalign tool is located under the tools directory of your android-sdk-windows directory; so it will also be wise to add this tools directory into your path.

SylvainL
  • 3,896
  • 3
  • 18
  • 24
  • For the record, I posted the signed version using the Export feature in Eclipse to Amazon yesterday, and my app has been accepted and it is for sale today. I had to do nothing else! – mikemeli Nov 28 '12 at 16:28
  • I've just made a quick check and indeed, you can post a signed APK to Amazon if you opt out of using the DRM or if you still want to use it, Amazon will sign your APK for you using a certificate associated with your account. However, the later can lead you into trouble if you later want to integrate some third parties API like Google Maps or Facebook SSO because you won't know the certificate used to sign your APK and this is needed to sign on for these two API. This info is from http://stackoverflow.com/questions/6217867/questions-about-preparing-an-apk-for-the-amazon-android-app-store – SylvainL Nov 28 '12 at 17:34
  • As a second comment, even when you don't want to use the Amazon DRM module, it's a good idea to export an unsigned APK and have Amazon sign it because this way, the signature will be different between the two markets. This will enable you to distinguish between these those from inside your APK using the code provided in http://stackoverflow.com/questions/5480235/supporting-amazon-and-android-market-links-inside-application?lq=1 if you later wish to post a link back to these markets. – SylvainL Nov 28 '12 at 17:52
0

You might also want to be sure that your icon in the AndroidManifest.xml file is 512x512 resolution, or else things will look a bit pixilated.

<application android:persistent="true"
    android:hardwareAccelerated="true"
    android:icon="@drawable/launcher_icon_512x512"
    android:label="@string/app_name" >
Ted Collins
  • 710
  • 2
  • 8
  • 15