Issues with application signature - android

I'm trying to create my own version of Gesture Builder. In eclipse I selected android project from existing code and I renamed the project and package name to new gesture. Then I added in android:fadeOffset = "1000" in create gesture xml(so that I can create gestures for letters like t and f) and in AndroidManifest.xml I set the version name to NewGestures and I set a different icon but when I try to run it I get this error message:
"Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data! Do you want to uninstall?"
From what I've seen online I need to match the signature used originally on Gesture Builder, but I've no idea how to do this on eclipse, shouldn't the signature have been handled properly when I created from existing code? Any help would be very much appreciated. I just need this app working so I can get a gestures library for a different application I'm working on for college.

This message concerns the application signature. This happens when you are trying to install an application on your device while an application of the same package name is already installed, but signed with a different certificate (see details here).
For example:
You have exported and installed your application using your Google Play keystore (so using your actual developer's certificate), and now you are running/debugging it from Eclipse, implicitely using the debug certificate (which is different)
You have runned/debugged your application from Eclipse at home on this device, and now your are running it/debugging it from Eclipse with another computer (which is using a different implicit debug certificate)
etc
Normally, below the error message, you have a button that allows uninstalling/reinstalling. If not, just uninstall your app manually and everything will be fine again.

versionName:
The version number shown to users. This attribute can be set as a raw
string or as a reference to a string resource. The string has no other
purpose than to be displayed to users.
package:
The package name serves as a unique identifier for the application.
The package name declared in your manifest.xml is what makes your application unique. Therefore, there can not be two application installed with the same package name at the same time. If you try this, your error occurs.

Related

Reinstalling android app without uninstaling

I have developed my first app using eclipse and uploaded to Amazon app store. Later, I realized some bugs, fixed them and re-uploaded. But, when I want to reinstall app over same/newer version, it says:
"The application you are installing will replace another application. All previous data will be saved" as other normal apks.
"And then it says application not installed." I have signed both versions using same key.
when you try to run the app(Let the new project name be AndroidAPP_v2) with all the bugs fixed ,then In eclipse It will show like this :"The application you are installing will replace another application".that means It will replace your old project(let it be AndroidAPP_v1) with new project(AndroidAPP_v2).If you click OK ,it wil automaticall install new app .
This is because both applications have the same package name. If the package name of the two applications are different, you won't get this message.
In fact, if the package name in the Manifest file (in the tag) matches the package name of another installed application, it will replace it.

Content Provider authorities

I am inheriting a code base that needs to be kept fairly in sync with the previous version to make updating to new versions as painless as possible when they push the changes via git. The changes I am making are related to re-styling and adding new features.
In the latest release, I was trying to install both the original version of the app alongside this custom version and got this error:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
I looked through my source control and found that in previous versions I was using the same authorities and name as the parent app, but I don't recall having this problem, but maybe I just never tested the case where both apps were installed at the same time?
In the original version of the manifest, this is the provider element:
<provider
android:name="com.foo.mobile.android.provider.Provider"
android:authorities="com.foo.android.mobile.contentprovider"
android:exported="false" />
I tried changing the authority to this:
<provider
android:name="com.foo.mobile.android.provider.Provider"
android:authorities="com.bar.android.mobile.contentprovider"
android:exported="false" />
But now the app crashes shortly after launch with SecurityException:
java.lang.SecurityException: Permission Denial: opening provider com.foo.mobile.android.provider.Provider from ProcessRecord{42cbc998 2462:com.bar/u0a191} (pid=2462, uid=10191) that is not exported from uid 10189
I've looked on SO and saw a couple of questions regarding this topic and also looked at the documentation and it all says I need this authorities to be different, but how can I keep this different while keeping synergy with the base code?
maybe I just never tested the case where both apps were installed at the same time?
I would presume this is the case. You cannot have two apps with providers supporting the same authority installed at the same time.
But now the app crashes shortly after launch with SecurityException:
My guess is that you changed your manifest, but you did not change the Uri that you are using to access the provider. Hence, your com.bar app is still trying to talk to the com.foo provider, and that provider is not exported.
how can I keep this different while keeping synergy with the base code?
Either this is the same app, or it is not.
If it is the same app, your first step is to switch back to the original package name. The only way you could have gotten Failure [INSTALL_FAILED_CONFLICTING_PROVIDER] is because you changed the package name and did not change the provider's authority. Changing the package name means that, from the standpoint of everyone outside of you and your team, it is a completely different app. Once you have switched back to the original package name (and rolled back to the original provider authority), everything should be fine, except that you won't be able to have the release version and the development version on the same device at the same time.
If you do indeed plan to have this app have a separate package name (so existing users of the existing app cannot upgrade to this new app), you will need to change the authority string in all relevant places. I presume that you can do this using a string resource, where you have different versions of the string resource. Or, if this is a free-vs.-paid app scenario, move to doing your builds using Gradle for Android, and set up separate free and paid product flavors, which can patch up your package name and authority data as part of the builds, without having to tweak the source code.

how to have 2 apps using appdatapreferences-android on same device?

I'm using https://github.com/googledrive/appdatapreferences-android to synchronize preferences data. I got the example working at https://github.com/googledrive/appdatapreferences-android-quickstart.
Then I started implementing it in my own app. When I tried to install I got the error: Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER. This error indicates that I had 2 providers with the same authority on the same device (which is NOT allowed). In this case the authority is "com.google.drive.appdatapreferences"
So I changed the authority in my app (manifest) to be distinct. But then the sync doesn't work anymore since the value is hard-coded in com.google.drive.appdatapreferences.AppdataPreferencesSyncManager.AUTHORITY = "com.sourcebrewery.appdatapreferences"
I really don't want to change the library code in appdatapreferences-android.
Is there any way around this? ...otherwise only 1 app per device can use this library :(

Android : How to Get Namespace of a Renamed Package Name For Facebook?

I have an Android app and its package name is com.domain.myapp. During the development, I have to change it to something else due to some reasons and I changed it to com.domain.myappandroid.
Now, I have to integrate Facebook SDK for Android and it asks me to add the package name and the class name of my Activity. My Activity is named GameActivity and it is in com.domain.myapp.activities, the package name didn't change to com.domain.myappandroid.activities after changing my app package name.
I know that the package name is com.domain.myappandroid but I am not sure if I should use com.domain.myapp.activities.GameActivity or com.domain.myappandroid.activities.GameActivity. I tried both and I don't know if it is working or not since the dashboard says 0 installs for Android.
Please help, thanks!
Note:
I am using using Facebook Android SDK v3.0.2 and I can't verify if it is reporting the app installs properly.
Write the package name of your app i.e. com.domain.appandroid. It will work fine.
actually you should use com.domain.myapp, the class name have nothing to do with the Facebook SDK function but callback to game site , it means wether classname you used, the Facebook function will worked well, but if you use the com.domain.myappandroid, players click the message that send by their friends, the game will not launched。。。。 so ~ use com.domain.myapp~ i just have the same case~ and i worked very well by this way!

Changing the package name of an upgraded Android application

During the upgrade of my android application, I changed the package name. But Android market doesn't allow to upload the changed package name application as an upgrade. If I upload the application as a new application, will the user have two applications on his/her device? How can I make sure that the user doesn't have to download the application again from scratch without reverting the change of my package name?
two package = two different application in market place.
Once you upload one app, its package should be same. Also, the key should be same.
Android market is only concerned about the package name in your manifest, not the actual packages name in the source.
You could try to give the old package name in the manifest attribute, then for activities give the new package name instead of relative (ie .MainActivity)
Like this:
<manifest package="your.old.package" ...>
...
<application android:name="your.new.package.MainActivity" ...>
Could work..
I plan to serve two versions of my app (paid/free) this way and using same project and code.
If you change the package name, it's treated as a separate app - not just in the market, but apk's in general will only 'replace' the same package name (and only if they're both signed with the same key).
Although it's possible to phase over to a new key by signing an intermediate package with both keys, there's currently no easy way to phase over the package name.
The best that can be done is this:
New apk version is signed with the same key, but has a different package name.
When installed, the new apk arranges to use the shared_prefs with the old package name.
The data is copied across to the new package name.
The new version requests that the old version is removed, and the user sees the uninstall dialog.
Note app data is usually kept here:
/data/data/pac.kage.name/
I haven't tried this, so I can't give anymore details yet. You may also be interested in my request for a seamless way of transitioning the package name.

Categories

Resources