tags:

views:

1229

answers:

4

Today I decided to start developing for the Android OS. I went on their website, downloaded all the required software (Eclipse, The Android SDK, ADT Plugin for Eclipse etc.). I followed the "Hello World" tutorial supplied (link text). I have it using the Android SDK 2.1. The program worked almost flawlessly. It runs fine on the Android emulator, but doesn't install on any Android phones. I don't own an Android phone, so I had three of my friends try to install the program on theirs.
The phones we used were:

  1. ROOTED G1 running 2.1
  2. Droid running 2.1
  3. Another Droid running 2.1

I emailed the .apk to myself in gmail, and accessed it via the Android emulator. It ran and installed the package just fine. However, when my friends tried to install it on their phones, they were all met with this error: "[Parse Error] There is a problem parsing the package"

I'm wondering if anyone has any suggestions as to what may be wrong. Thanks for your help.

A: 

How are you installing the package ?
You should :

  • Install AppManager from the Android Market.
  • Get the .apk file on your SD card.
  • Start AppManager and click on the "menu button".
  • Select "Install" and the application to install.

If the application doesn't show up, select "Whole SD" to see all the SD card applications.

Damien MATHIEU
Ok. I'll try that in the morning. We tried to install it two different ways:1. Stuck it on the SD card. They said when they plugged the SD card into their phones, and went to the .apk file, that it instantly tried to install and gave them that error.2. I emailed the .apk file to their gmail accounts, and they accessed gmail from their phones and tried to install it from there. It gave the same error.I'll let them know to try your suggestion next. Thanks for the help.
ConfusedDeveloper
It worked. Thanks a lot. :D
ConfusedDeveloper
A: 

You shouldn't have to use a custom app to install something. Simply trying it open it from the SD card (ok, so you need a file manager for that :p) or accessing directly the file via email really should work. There are two things to check:

  1. As I put in the comment, what's the package name you're using?
  2. Do any of those phones have the setting to allow applications from outside the market to be installed? It's done via settings -> applications. If none do, then the installation might not have been allowed because you probably didn't sign the app as a "finished app" - by default things are signed with a debug key.

Edit:

I just Googled around, and it turns out a few other people have had this problem. However, in each case it has been solved in a different manner... In one case, using a 3rd party filebrowsing app solved the problem. In another case, the dev had renamed the .apk file after signing and exporting it, and apparently that was enough to break it for him. This doesn't make any sense to me though - I just tested it on my phone with three different versions: signed with the debug key, signed with a 'proper' key and signed with a proper key and then renamed. In each case the app was copied to my SD card, opened with Astro (a file browsing program), which in turn launched the built-in installer app. All three worked, so I don't know how the other guy had problems with renaming his .apk.

So... I don't know. Sorry :/ Maybe try installing it from a debug-key-signed apk, or maybe start another project from scratch and see if somehow your manifest file got corrupted.

To answer your comments:

  1. The package name is the com.example.helloandroidtwo style name. The apk name is just the name of the zip file (APKs are just zip files!) and shouldn't make a difference. Your package name looks fine, hmm.
  2. It turns out you did sign your application 'properly'. Generating a keystore like that makes it use a proper key rather than a debug one. I didn't think it'd make a difference, but it was worth checking. I don't bother signing my apps with a proper key until I actually put them on the Market.
  3. Taking API level 7 is fine since all your test phones are also running level 7 (v2.1). Normally you don't want to set the mininum version to 7 since that excludes the majority of users, but that shouldn't be your problem here. Just to be sure though, edit the project properties to set the target to be level 3. Unless you downloaded all the API levels when you started, you probably won't already have it. Download it using the AVD Manager in Eclipse.
Steve H
The package name is "HelloAndroid2.apk" I believe that's the name you're looking form, correct? Unless you mean in the source code, in which case I have it named: "package com.example.helloandroidtwo;"All three of them have the "Unknown Sources" box checked.As for the debug key, here's what I did in eclipse:Export->Export Android Application->selected project HelloAndroid2->Create new Keystore. Then I made a new password, hit next, made a new alias, and then hit finish. Did that make a debug key? If so, how would I make a release key?
ConfusedDeveloper
Also, for reference, I'm using the Android 2.1 API. This is the correct one to use, right? Because there is also the Google + Android 2.1 API. The tutorial said to use Android 2.1, so that's what I did.
ConfusedDeveloper
@ConfusedDeveloper: I've edited my answer to provide some more info.
Steve H
Thanks for all your help, we finally got it working. I'll be sure to change my target levels to lower numbers too. Thanks again for all the help.
ConfusedDeveloper
A: 

The easiest solution is to use the browser to access your gmail account via http://mail.google.com and the download the attachment using the link. After that, you can run the install, provided you enabled the installation of non-market applications.

Roel Spilker
A: 

Yup dont change the apk after signing or it wont parse.