My existing Keystore does not exists - android

I was updating my code for next version. After i clicked "export signed Application package", i got this error stating that my keystore does not exists. Actually i didn't delete it for sure. Now i am unable to update the app since the existing keystore vanished. Just to check whether i have deleted the file, i tried all recovery software. But unable to find. Tried all similar questions and there was no suitable result. Now please help me to recover the the old keystore.
(sorry for bad English)

First Check out ,Where is your key Storeexits ? at the default location or you have stored at some where else.
Default Path
Other Location
If you are storing your Key Store at other location then check out that rebuild time so you will get idea.
And if there is a okay with everything the issue is about password.
So,It will be good if you Create New Key Store and use it

You cannot create upgrade application if you loss app's keystore.
You have to rename your package, create new keystore and publish as a new application.
There are some rules about keystore:
When create keystore, you have to choose expired date is greater
than 20 years.
Create with password to sure that you can remember
it.
Keep the keystore file you generate with Keytool in a safe,
secure place (Best place is on Google Drive but please not
same account that you published your app, Dropbox, Box, ... ) and never loss
it. If you loss it, you have to do same above things.
Hope this help to remember.

Related

Firebase google-services.json file

I have a question regarding the Firebase google-services.json file. Every time I add o change something, for example, if I add a new SHA1 fingerprint, do I need to download the file again and put it on the app folder of my Android project? or just the file created the first time is enough?
I am asking because I am having issues with the Phone authentication and I need to know if the problem lies on this matter.
Yes, every time you add a fingerprint (or new package name) you will need to pull down the google-services.json.

I have changed the package name of my app but on Firebase, it is still the previous one. Please see details

I decided to change my app's package name and changed it using this tactic: https://stackoverflow.com/a/29092698/6144372 and then manually changed the package name defined in google-services.json file under this tag: "package_name": "com.xxx.xxx", but when I saw the package name in the Settings section of Firebase Console, it still shows the old one there.
So, I wanted to know that will it cause some bad effect on my app's performance in future or will it not do any harm? Please let me know
And if there is some way of changing the package name in Firebase Console settings too, let me know that too.
You should consider creating a new Firebase project. Just delete the old project and create a new one, with your new package name. I am not sure about the performance issues of just changing the old google-services.json file, but creating a new project is certainly more secure to prevent any future issues.
UPDATE: Thanks to TommieC.'s comment, a better way would be to add a new app to the project and just delete the old app. The new app will have your updated package name. Then download the google-services.json and replace it with the old file.
This method would be safer, in case your firebase project already has different integrations and deleting it is not really an option.
The problem arises when your firebase package name and application ID doesnot match. There is no any rename features in firebase project. You should create the new firebase project that matches the application Id and delete the old project. Then just import respective firebase project json to your code project. That should do the trick

Re-signing an APK and getting data through ContentProvider

I am currently writing an app (App A) that depends on another app's data (App B).
Being an Android noobie, I thought that the only way to enable that is to use a ContentProvider and doing a query.
As it stands, the current way of doing is problematic, because App B has another signature than the one we're using for App A. This means:
The only way we can get our apps to talk to each other is to send our apk on a signing server so that it is also signed with the same key used for App B
This process is not automated, so it is therefore time-inefficient (takes around 2 - 4 mins).
This also mean we can't set debug points, which causes us a lot of pain when trying to see what data exactly is being returned by the ContentProvider
I did some more research and got told by a colleague that instead of signing our apk every time we make a slight change, we could extract the apk of App B and sign it with our key only once.
It led me to then create a keystore and key for my team, which I used to re-sign App B's apk and reinstall it on our test device. I then set my Android Studio to automatically sign the debug versions of App A with that exact same key.
The problem is that didn't change anything unfortunately...
It always ends up with the following exception being thrown:
Failed to find provider info for com.App.B.provider
(basically the same error thrown when we are using the default App B apk withouth sending our App A apk to the signing server)
Just to point out, if you're wondering, sending App A's apk to the signing server and running that does work and we're getting the data from the ContentProvider
So yea, I'm not sure what to do anymore... Any ideas ?
Also, since I'm not sure I have a clue of what I'm doing, any explanation of how these things are supposed to go would be very welcome !
<provider> tag should be placed inside <application> tag.
Also, be careful not to put it inside an <activity> tag.
Also you can get it working specify full path in <authorities> tag in manifest file (see SearchableDictionary sample code in SDK).
<provider android:name=".DictionaryProvider"
android:authorities="com.example.android.searchabledict.DictionaryProvider">
Alternatively you can use external storage,create directories and access the data from there directly.

is it possible to mark, "brand" an apk?

Good day all.
some times ago I asked about modifying an apk on the fly, the thing I would like to achieve is to track an ak from the download to the uninstall, via some track calls during its life.
the first thing first, of course is to find some way to "brand" it before the user downloads it on the phone.
things to take in advice are:
I will not use the normal store to give the apk to people.
I can't make the user wait for 30 seconds during the download to make the build on the fly.
I can't ask users to "register, or login" I'm not able to arrive to that part to the server, too bad.
so far I have only guessd about modify the apk code on the fly, to search for a pattern in its code, and change it accordingly to my needs and save it on the database.
for example, lets say that in the values.xml there is a url like this:
www.server.com?token=xxxxxxxxxxxxxxx
before servince the apk to the user, i search for the pattern xxxxxxxxxxxxxxx and change it with an alphanumeric value that i save on db, later, when the user go to the url via the apk, he will bring the token value and I could continue to track him again and again...
ok, this is the situation.. my question is simple... any ideas? am I mad... does someone already do this without any efforts and I'm try to reinvent the wheel?
You can't modify the apk, it would break the signing.
You would need to resign it. If you're able to resign it, you could easily change a value in an xml file of your choice.
It's rather easy to achieve with a bash script.
#!/bin/sh
sed -i ‘s/replace_key/actual_key/’ app/src/main/res/values/strings.xml
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
why dont you save the URL prefixes in DB instead of values.xml or in code. and when the user installs the apk, do a server hit in the Application class and get your tokens the first time and persist in DB. Since you say you already know the logic to generate the tokens fo reach user, so it should not be a big deal to generate the same token when users ask your server for it.

Completely uninstall and reinstall Android app on update?

I want to publish a new version of my app. But I want it to reinstall again.
Like first uninstall and then install(like first time installation). Is there anyway that I can do it? Or force users to first uninstall the app?
If you sign the new apk with a different key, users will hit an error when they try to upgrade an existing installation. That’s probably the easiest way to do it without changing the package name.
As Jens said you can't do this really unless you reinstall with a different package name (not a good idea either.) You have to detect your version and manually reset your preferences etc. if you need to. This is a pretty annoying feature of android. I've been developing a mapping application that has the exact same problem with storing some of the background data.
You can usually check where your preferences get created for the first time. A lot of people do a if(preference !=null) to set them up, since in a pre-installed app you already have that preference in the bundle it will not update or generate a new one.
Try setting the preference checker to be if(preference != newValueOfPreference)
If that's not how your bundle data is generated on install you'll have to find out how it is generated and get at that hook.

Categories

Resources