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
Related
I want to upload my app to Google play store. After uploading the signed aab file in play console, I got this error:
You need to use a different package name because "com.example" is restricted.
So, I went to my android studio project and renamed my package. Now I constantly keep on getting the error:
error: package R does not exist
I changed the package name in my manifest file, and also tried cleaning and rebuilding the project. But it's not working. How do I resolve this issue?
Error
If I use com.example.electric_viewing.R then it works. Why?
I renamed my package this way:
Another good method is: First create a new package with the desired name by right clicking on the java folder -> new -> package.
Then, select and drag all your classes to the new package. AndroidStudio will refactor the package name everywhere.
Finally, delete the old package.
Done.
When I debug app or run app on my device everything's working fine. But when I try Generate Signed APK there's error:
I believe it has something to do with this:
good method but had to do 2 more things(other than updating manifest file) to make it completely work, firstly had to change/rename the R file imports in whole project and secondly appdebug was using old package name( visible in run window of studio) added applicationId "com.packagename" in app build.gradle defaultconfig
But I don't know what means "change/rename the R file imports".
Everything's fine but "cannot find symbol variable". That's strange becouse when I see code everything's fine:
It seems that every "R.id.something" I have in code is wrong. But there's no problem when I build debug apk, only with signed apk.
I tried Clean Project, Rebuild Project, Invalidate Cache/Restart, even restarted my pc.
There are 40 errors, same problem in all classes:
1 ) close your studio
2 ) go to the Project_Name\Module_Name\build\outputs\apk\
3 ) delete that apk
4 ) restart android studio and go to Build>Generate Signed APK
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
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.
I changed the package name of the application by following How do I rename the android package name?
However, the old package name is still being shown on the android device that the application is installed on:
Android->Data->"old package name"
If you are using Android studio make sure you change applicationId in the Build.gradle file