unable to create signed apk (keystore) android studio 1.4.1 - android

I saw many tutorials in which the user is able to select the folder to create new keystore in....but in android studio 1.4.1.... I can only select *.jks files. Also I created a keystore using keytool (java) and then created the signed apk choosing existing keystore....I was able to create app-release.apk....but google is giving this error on upload
You uploaded an APK signed with a certificate that is not yet valid. You need to sign your APK with a certificate that is currently valid. Learn more about signing.
You need to use a different package name because "com.example" is restricted.

You cannot have certain names like com.example and com.google in your package name. Your package name has to be unique in play store.
Apart from that Android follows the same conventions for naming packages as Java does.
Generally to make it unique, the package is named like yourDomainNameInReverse.YourAppname
For example, the package name for Mozilla firefox android app is org.mozilla.firefox

if you are using android studio the change applicationId in build.gradle file.
your current app id id like applicationId "com.example.zyz" then change it to applicationId "com.testmyname.zyz"
no need to change/manage packages & code

Follow the steps
Select Project -> Click Build -> Click Generate Signed APK
then follow the process shown there..

For the first error:
You uploaded an APK signed with a certificate that is not yet valid. You need to sign your APK with a certificate that is currently valid.
Answer: I had to change my system date to two days back and then again generate the keystore. ....or you can simply wait till your certificate becomes valid.
For the second error:
You need to use a different package name because "com.example" is restricted.
Answer: In Android Studio go to the tree hierarchy and right click your package name folder under "app/java/your_package_name" and go to refractor and then rename. A pop up will appear....choose rename package and rename it to something else than default com.example.package_name. Also change it in AndroidManifest.xml file.

Related

Unable to generate a signed APK for release in Android Studio

I'm trying to generate a signed APK for my app in Android Studio by going into Build->Generate Signed Bundle/APK , but I keep getting this error when I select the release build variant.
Execution failed for task ':app:packageRelease'.
Failed to read key keystore from store "C:\Users[PATH]\keystore.jks": Keystore was tampered with, or password was incorrect
I'm pretty sure that my password is correct because the apk generates correctly when I select the debug build variant instead of release. The keystore also works fine for my other projects.
I tried cleaning, rebuilding the project,invalidating the cache/restarting, and changing the destination folder, but nothing worked. Does anyone know why this is happening and how I could solve it?
Check your keystore file for first, in you example you creating file with name keystore.jks If its correct and really present in folder user check alias
Turns out that the problem was my build.gradle version.
Same solution as #S. Gissel in Cannot compile a signed APK in Android Studio 3.3
I was able to solve this by providing the specific file path of my .jks and not just the folder.
ex.
INCORRECT key store path
C:\Users\john\Desktop\Projects\ProjectName
CORRECT key store path
C:\Users\john\Desktop\Projects\ProjectName\helloworld.jks

Error when building after renaming "com.example"

Ok so when releasing an apk google play said that I need to use a different package name because "com.example" is restricted. After that i rename the package and suddenly gradle just stops building with the following errors in the "build folder".
image of the errors

How to create a project with the same package name and SHA-1 key I've already used in my recently deleted project in Firebase?

Here, while trying Firebase Authentication it is showing me some error message.
An OAuth2 client already exists for this package name and SHA-1 in another project
You need to follow these steps:
Ensure that your project was actually deleted and the SHA-1 key isn't used in another project
Create a new project, with another name (different from the one that you already deleted it)
Change the name of the new created project with the name of the project you deleted.
Add the SHA-1 key
Download the JSON file and copy it in the coresponding place
Run your project

Use Firebase application for different flavors

I have a main package which called "project" and a flavor called "flavor"
The error " No matching client found for package name ..." occure when project tries to build and didn't find the project package name in google-services.json. In my case, "project.flavor" is missing which prevent project from building.
If i try to add ".flavor" manually in google-services.json file , project will build normally, and android app will start, but authentication with Firebase won't work.
Can we use same google-services.json file for different project flavors ?
I Finally found a solution.
For Firebase to work with flavor, i added new Firebase application using "FirebaseConsole" and put it's package to "project.flavor", added my generated SHA-1, then downloaded the .json file and imported it to my flavor package inside ANdroid Studio.
Works like a charm <3 <3 :D
Conclusion : Each project flavor needs it's own Firebase application, and it's own google-services.json

Android change package name

Is it possible tou change the project name of an apk outside android studio?
i need a tool if exists, to change the com.example.app into com.myapp.app but without any IDE, only with the signed apk file. Is it possible?
Try to type packageName com.my.name in build gradle.

Categories

Resources