How can I work with google play service on different computer - android

I got the SHA1 using this:
How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
and then I did a setup for google play service and everything works fine.
When I run the app from my android studio but when I go to the other pc and tries to run the app its says "failed to sign in". So my question is how can I work in two different workstation and have the same signed app? I also tried to sign the app with the Build > Build signed APK and it didn't work.

When you running the app in debug mode via Android Studio, the apk is signed with the debug key. For each computer, the debug key is different. The debug key is placed in $HOME/.android/debug.keystore. So you need to use the same debug key by copying the key to another computer.
To build an apk with signed key, you need to generate your key first. Please see in Sign your release build.

Please ensure you are using the same key to sign the APK. Transfer the KeyStore (.jks) file to the new computer you'd like to sign the app on. Be sure to enter the correct password which you assigned when creating the KeyStore as well. For more information, see the docs.

Related

Google Sign In doesn't work with Trusted Web Activity (TWA) release apk but works in debug apk

I am using Trusted Web Activities(TWA) for the Android app. My app uses Google Sign In for Authentication (Firebase). In debug mode, it works as it should. But when I install the release apk and try to Sign In, authentication fails and the app restarts.
I do know that you need to add SHA-1 fingerprint in the Firebase Project settings for your app, but my project is a web app and there is no option to add fingerprint for the same.
There's no difference on the browser side between a debug and a release APK. What seems to be happening in this case is that the package signature (and the SHA-256 fingerprint) are different, which cause the Digital Asset Links validation to fail in the release APK and causes the content to be opened in a Custom Tab.
You can use Peter's Asset Links Tool to get the SHA-256 fingerprint for the release APK installed on a device, then update .well-known/assetlinks.json accordingly.

I am trying to upload my APK into the Playstore but it is not working... :(

I am trying to upload my app to the playstore but when I upload the APk this error appears, "You uploaded an APK or Android App Bundle file that was signed in debug mode. You must sign your APK or Android App Bundle in launch mode." I am not sure what to put in the com.company.name thing, or if that is the problem or not.
I did the app using Unity and I am not sure if maybe I did a mistake when I was building into the APK. This is the first app that I publish an APP and it is for a school project. Any help on the subject would be great.
In Android, you create something called a KeyStore. Android Studio creates a debug KeyStore by default, and most people don't even think about it. However, if you want to 'Release' your app to the public, you need to 'sign' it with a 'Release KeyStore'. So, Google how to create a Release KeyStore, and do that first. Then, when building your app for release, at least in Android Studio, you would go to Build/Generate Signed Bundle/APK. Then, you would select your Release KeyStore and enter the passwords and alias. This will then sign your app for Release, and you'll be able to upload it to the App Store.
You need to sign your app with a unique key. You can read more about it here - https://developer.android.com/studio/publish/app-signing
Here you can see how to sign your app in Unity: https://answers.unity.com/questions/326812/signing-android-application.html?childToView=600281#answer-600281

Different types of APK

Can someone please explain the difference between:
signed apk
unsigned apk
apk in debug mode
apk in release mode
Although its clear that signed apk is the one you generate apk with your own certificate and the unsigned one without without certificate.
Especially what are the apk in debug mode and apk in release mode really mean?
How are these two related with signed apk and unsigned apk?
Edited: Also is there any more types of apk apart from this?
I have already read the docs at http://developer.android.com/tools/publishing/app-signing.html
It only explains about the Signing in Debug Mode and Signing in Release Mode, but they didn't mention anything about the apk in debug mode and apk in release mode.
The same way you can have documents signed with a digital key to prove their origin and ownership and websites have a certificate for that, you can do the same thing with APKs by signing them using the tools provided by the SDK.
Unsigned vs Signed APK:
One has been signed and the other has not. Just like that. Think of GPGed emails or Websites with the Green thingy on the address bar for signed APKs and plain emails or websites with no ssl for unsigned APKs.
Before we talk about debug mode and release mode, I'll give a very brief explanation on signing, actually talk about authority-certified signing and self-signing.
When you go to a SSL protected website you might see either a warning message or a red X by the url, depending on the browser, warning you that the certificate can't be trusted. Normally that means the website is using a self-signed certificate. What that means is that you can't really tell who made the certificate and no one can really say it's secure for real or that it comes from where it says it does.
On the other hand, the Authority-certified signed certificates, they have someone(a company) which is known and (is supposed to) guarantees the quality of the certificate and that who's using is who it should be.
Now back to APKs:
When you're just testing your app, when you want test it, you don't really need a proper certificate as you're the one installing the app on your device and you know (at least you should) the app you're making is not supposed to cause any problems.
On the other hand, when you put them in the Android market, it is important to know that the app people are downloading are really yours, so that's when you're gonna use a properly signed certificate. The one you can't lose and blah blah blah.
This brings us to Debug mode and Release mode.
They are just build/deploy environment/settings to help you be more productive.
When you select debug mode, the apk will(might?) contain a lot more debug info (and for that be bigger) and will normally be signed with your self-signed certificate (the debug key) which is (most normally) automatically generated.
when you select release mode it (should) strip useless debug information reducing the size of your app and will properly sign your APK with a certified key which is necessary to release apps in the market.
Hope this helps and if you need more clarifications ask in the comments
From Android docs:
You can sign an app in debug or release mode. You sign your app in debug mode during development and in release mode when you are ready to distribute your app. The Android SDK generates a certificate to sign apps in debug mode. To sign apps in release mode, you need to generate your own certificate.
That is, when you are going to distribute your app, you sign your app in release mode with your own keystore file. Signing in debug mode is generally done automatically by your IDE.
You can build unsigned only via command line as far as i know.
Here is how to do it Build unsigned APK
Here is an extract from the link for you.
Build unsigned
If you build your application unsigned, then you will need to manually sign and align the package.
To build an unsigned .apk in release mode, open a command-line and navigate to the root of your module directory. Invoke the assembleRelease build task.
On Windows platforms, type this command:
gradlew.bat assembleRelease
On Mac OS and Linux platforms, type this command:
$ ./gradlew assembleRelease
This creates your Android application .apk file inside the project bin/ directory, named -unsigned.apk.
Note: The .apk file is unsigned at this point and can't be installed until signed with your private key.
Once you have created the unsigned .apk, your next step is to sign the .apk with your private key and then align it with zipalign. To complete this procedure, read Signing Your Applications.
When your .apk has been signed and aligned, it's ready to be distributed to end-users. You should test the final build on different devices or AVDs to ensure that it runs properly on different platforms.
To install any apk to any device they must be signed, unsigned apks can only be tested in the emulator. while signing you can do it in a couple of ways this is a extract from developer.android.com
http://developer.android.com/tools/publishing/app-signing.html
Signing Overview
You can sign an app in debug or release mode. You sign your app in debug mode during development and in release mode when you are ready to distribute your app. The Android SDK generates a certificate to sign apps in debug mode. To sign apps in release mode, you need to generate your own certificate.
Signing in Debug Mode
In debug mode, you sign your app with a debug certificate generated by the Android SDK tools. This certificate has a private key with a known password, so you can run and debug your app without typing the password every time you make a change to your project.
Android Studio signs your app in debug mode automatically when you run or debug your project from the IDE.
You can run and debug an app signed in debug mode on the emulator and on devices connected to your development manchine through USB, but you cannot distribute an app signed in debug mode.
By default, the debug configuration uses a debug keystore, with a known password and a default key with a known password. The debug keystore is located in $HOME/.android/debug.keystore, and is created if not present. The debug build type is set to use this debug SigningConfig automatically.

Release and debug version of the application in Android. Two certificates

I have created release (exported) version of the app. That created problem that debug version uses debug certificate for signing and exported version uses different certificate.
Is it possible that they both use the same release version certificate?
If yes, then is it possible to save certificate password, so I don't have to type it every time I export (or compile) application?
If this is not advised or impossible, then how do you deal with Android shouting about Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] every time you want to install release app into device which already has debug app installed?
And how do you deal with Android Google Maps API V2 not working with debug certificate, because AndroidManifest.xml has the key which works only with app signed with release certificate?
You can automate your build process with gradle or ant. Once you do that its easier to build the signed apk. Using the latest Android studio you can create multiple versions of the same build at a time.
This question and its answers will help you resolve this .
To answer.
If a app is signed with same certificate it won't cause any issue, and basically there can never be two version of same certificate. Second, yes by default sdk use debug certificate to sign your application , and while releasing its on you to choose which certificate to sign.
You can create a batch file with predefined command to Sign you application, all you need to do is
a. release your application raw, withouht signing
b. Use Jarsigner, and your custom made certificate to sign it
c. Use Zipaligner to optimize it, you can easily club this command in a batch file (in windows)
This error shows up when, already installed same application carries a signature of different certificate then what you are trying to push again, so either you remove preinstalled app manually and install new one, or sing the new app with same certificate in push it into device.
You can very well integrate Google Maps APIv2 with debug key, all you need to do is to register your app with google using hash of debug key and using generated key in your app.

Android - can no longer see google Maps after going to production

All,
I have been banging my head over this one for a few weeks now. I got google maps v2 setup for debug following all of their directions. I got my debug key based on the debug.keystore and everything worked great.
I was then releasing my application to the Google Play Store and followed the instructions on how to generate my release key and I generated my Google API Key using the Sha1 of the release key as the instructions state.
I released my application to the store and everything works great. Here is the problem though, I can no longer get the maps to show up even when switching back to the debug API key.
Currently to debug I have been releasing a build to Beta, waiting 3 hours, and then fixing accordingly. Luckily my map work has stabilized on this application but I would still like to understand what is going on.
Any ideas anyone?
I suggest that before you release to actually build apk in production mode then do adb install to your device. I try it and see if it works. At least it guarantee working before putting it up
Make sure that the map key id you use in the manifest is for release mode not debug mode.
Just before exporting the app as apk, replace the Google Maps debug key with release key. It worked for me.
Debug certificate: The Android SDK tools generate this certificate automatically when you do a "debug" build from the command line, or when you build and run a project from Eclipse without exporting it as a released application. The certificate is only for use with an application that you're testing; you can't publish an app that's signed with a debug certificate. The debug certificate is described in more detail in the section Signing in Debug Mode in the Android Developer Documentation. You can generate an API key from this certificate, but only use the key for testing, never for production.
Release certificate: The Android SDK tools generate this certificate when you do a "release" build with either ant program or Eclipse. You can also generate this certificate using the keytool program. This certificate can be used with an app you release to the world. Once you have the correct certificate for your needs, you can display its SHA-1 fingerprint using the keytool program.
More here: Google Maps Android API v2

Categories

Resources