error: package R does not exist after renaming package - android

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?

Related

Can't Generate Signed APK after renaming Package

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

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

No matching client found for package name 'com.google.firebase.udacity.friendlychat'

I'm getting an error about my android project,
enter code herehere the error :
Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.google.firebase.udacity.friendlychat'
If you are downloading the code from firebase. Make sure that all the dependencies and filenames are correct. Like your filename should be same as the downloaded filename.
I am pretty much sure that package name in your google-services.json file is different from your actual package name. Go to firebase and check the package name of your app and then download the google-services.json, paste it in your app module. This will solve your problem.

Error message keeps appearing when cloning android studio project

So, I'm currently working on two ideas that hit me simultaneously.
I managed to get quite a ways in the one project, and decided to copy it as a starting point for my other project. The only problem is that when I tried to copy the project and rename the package name / applicationID, I was hit with an error.
As such, I tried to make a new project and copy the files over individually, renaming the package manually in each of the files. I'm still getting error messages. The exact error message I'm getting is
Installation failed with message Invalid File: C:\Users\Owner\AndroidStudioProjects\App3-test1\app\build\intermediates\split-apk\debug\slices\slice_6.apk.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
Now, I'm still a novice, but I'm assuming it's saying that the copied app won't run unless I uninstall the original.
Is that the case? How can I clone the project in such a way that I can get both to be installed on the same phone?
P.S. I'm not sure if it's relevant, but I'm testing on a Nexus 5x.
Don't copy the whole project. Just create a new one with a different package name. Don't copy everything, just the classes, xml's and drawables. then copy just a portion of your AndroidManifest.xml file like uses-permission and activity. Do not use previous package name manifest. Do the same thing in build.gradle file. just copy your dependencies. hope it helps

unable to create signed apk (keystore) android studio 1.4.1

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.

Categories

Resources