开发者

Android "Hello World" tutorial program. Error: [Parse Error] There is a problem parsing the package

开发者 https://www.devze.com 2022-12-29 19:57 出处:网络
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 Worl

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.


don't worry. Its a little problem. I also spend one week behind this and finally I got the solution. Just go to you manifest.xml file and perform fallowing changes.

//uses-sdk android:minSdkVersion="14" 

Just change it to

//uses-sdk android:minSdkVersion="3" 

Or any lower level sdk version that our device support. Try it. And reply, whether You satisfied or not.


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.


Go to your manifest.xml and just delete the

uses-sdk android:minSdkVersion="14"


I recently ran into the same problem. I solved it by porting an app from a Andriod SDK (4.0.3) to one supported by the phone I was deploying the app to (2.3.3).


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号