开发者

Failed to install apk file by Package Installer in Android?

all, I have some problem installing my apk file in code. Wondering if anyone could find out what I did wrong. What I was trying to do is put a Check Upgrade function in our program. When user clicks it, it will send request to our web server and find out what is the latest version. I use app versionName to stamp a version, something like 2010.11.23. I don't use the version code in Manifest.xml file. So our program sees the latest VersionName is later than itself, it will download the latest one, and then use the following code to install the new apk file:

Intent intent = new Inte开发者_如何学Gont(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(strNewAPKFile),"application/vnd.android.package-archive");
this.startActivity(intent);

Now looks like, everytime when I changed the VersionName, it will fail to install the apk file. It downloads the file fine. I don't know exactly why. Sometimes, in Eclips, when I hit debug, I got error saying "Re-installation failed due to different application signatures". I don't know if this is the same error caused the installation failed.

So, looks like my questions are:

  1. Should that upgrade logic work? I am wondering if it has something to do with the VersoinName.
  2. What could cause the application signature change? (I did sign our program before I put it on our server, but I always use the same key file for different versionName. )

Any input are welcome.


The app is signed whenever you create it. If you create it with Eclipse, it will be automatically signed with a debug key. If you switch computers, you will likely have a different key. If you export the app unsigned and then sign with your own key, it will have your own key. Each key is incompatible and will require you to uninstall and re-install the app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜