Renamed react native app, Activity class MainActivity does not exist - android

For my app to be accepted on the play store, I have had to rename my app.
I have changed the applicationId in build.gradle
defaultConfig {
applicationId "com.tcapp" // from
applicationId "com.rg.tcapp" // to
When I run react-native run-android I get the error:
Error type 3
Error: Activity class {com.tcapp/com.tcapp.MainActivity} does not exist.
What other files do I need to change to rename my app and get it running?

If you want to rename an application, you can use react-native-rename to do it

I've recently changed my package name in react native due to which the entire folder structure needed to be changed in android. react-native-rename didnt help me, but i've followed the steps of the verified answer of the below link, please do check that out, it will help you. Follow all those steps. Rename android package and application name

Related

App is not installed after changed applicationId

I'm new to Android development.
I finally finished up my first android application and
tried to upload on google play.
then I found out I can't use com."example" package name for uploading.
so I already changed all my package name to com."◯◯◯" and it worked fine.
but once I changed applicationId in gradle app file which corresponds to the package name, my app is not installed any more...
there's no error message in android studio and seems to fine.
I did clean and rebuild, invalidate caches/restart, uninstall existing app on my device, etc..but any of them not working.
I couldn't find any solution for it. please help me to fix this problem.
thank you
---update. case solved---
It was because if you change the applicationId, the installed app is brand new one(doesn't have any data in the database). so the problem was null variable which I didn't make it nullable.
thank you for your help.
change all place-name where package name use it then try

Google play throws a message (see below) when I try to upload signed app release .apk file

I am trying to upload an app to Google play from the Google play developer console, and it throws the following message when I try to upload an apk file: "You need to use a different package name because "com.example" is restricted." The package that my app's classes belong to is called com.example.myname.converter. What is the best way to fix the problem without messing things up?
In Android studio build gradle file change the package name.
The defaultConfig like this
applicationId "com.example.android.applicationname"
change that com.example package name
applicationId "com.yourcustomname.yourcustomname.applicationname"
then clean and rebuild project
You need to specify a valid appId. An appId like com.example is, for sure, not the correct one.
For instance, if you app is from Facebook an app id like com.facebook.app is the correct choice.
Se more information about the appId here.
For updating your app id, just go to your app build.gradle and change the field applicationId.

Changing Firebase Package Name

I have a app with Google Sign-In integrated with Firebase. I recently changed app package name for release purpose. and now running throwing this error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name '<Package Name>'
So I am guessing Firebase cant recognize app with the new package name. How can I change Firebase package name. I have gone through Firebase console but can't find any changing package settings. Or is there any good way to achieve this instead of creating new project with package name and code again? Any help would be appreciated.
As Eurosecom commented, you can just add a new Android app to your existing Firebase project with the new package name. After doing this, download the updated google-services.json and add it to your app.
Note that Firebase does not use the actual package name from your Java code, but uses the applicationId from your app's build.gradle file:
defaultConfig {
applicationId "com.firebase.hearthchat"
When you initially create a project in Android Studio, the package name and application id will have the same value. But if you refactor your code into a different package, the application id won't be updated. That explains why the app will continue to work after such a refactoring. But it can be confusing at times, which is why I prefer keeping them in sync.
If you are using Firebase assistant then:
Delete your app in the Firebase console in the project settings.
Back in Firebase assistant reconnect to the Firebase for any service.
It will ask you to sync with the project. Click on Sync.
The app with new package will be added and the google-services.json file will be automatically updated.
Also note that the package name of the applicationId value in the build.gradle file is considered.
Cheers
There's a better way of resolving this issue.The error can be as result of you having a GoogleService Json file in your app folder, All you need to do is; try and locate your google-service.json file under app folder, and change the package_Id to the new package_id you have created; Save, Do a Clean and Rebuild Project, your problem would be resolve. Hope this will help you. It works for me. You can kindly votes if this also help you. Thanks

Change Application Package name through Android Studio

I am aware that this question is asked several times in SO. I have checked below answers posted but doesn't work for me :(
Solution 1
Solution 2
Currently, my application's package name is "com.example.test".I want to change this to "com.example.test.test1".So, I just changed the package name in my manifest file and build the app.
Now ,if I run both the applications seperately with above package names changed from manifest files into device than it should show me different applications.It shows me error as "Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]"
As the package names are different, it should show me different applications in the device instead of overriding one app with other.Help me out.
Any help would be appreciated.Thanks
The packageName attribute is deprecated as of Android Studio V0.0.6 onward. To change the package name of the application, use applicationId instead. Check the release notes here.
Change the applicationId and sync gradle.
If your aim is to have the same application at two instance in the device, it is so easy to do using gradle. You don't need to change package name in the Manifest file, gradle will handle that during the build process for you and do all package renaming under the hood wherever required.
In order to achieve that you need to write a new product flavor for your app inside the main app module's build.gradle file with a different application id(package name). Eg. if com.example.test is your default package name of the app. You can have a different flavor of the same app with a different package name or knows as application id. produltFlavours can be defined inside android tag of your main module's build.gradle file like as shows below.
productFlavors {
app1 {
applicationId "com.example.test.test1"
}
}
Sync your project after making the changes. Now select the build variant from Build Variant tab in left hand panel and hit run. Gradle script will handle all package renaming for you.
Check this once for more details :
Android Gradle Build Variant Deploy
What worked for me:
1. Right click package you want to change under java folder|
2. Refactor -> Rename|
3. Rename the package -> press "enter" -> press "Do Refactor"|
4. This updates all the files including the manifest

"com.example is restricted" when uploading APK to Play Store

I am trying to upload my finished android app to the android market and I am getting this error:
You need to use a different package name because "com.example" is restricted.
In Android Studio after renaming Package then go "build.gradle (Module:App)
defaultConfig {
applicationId "com.example.android.abc"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
change the line
applicationId "com.example.android.abc"
to
applicationId "com.tanxe.android.abc"
relpace "tanxe" with the word you want or your Organization name i.e.
your new package name
and rebuild the project
The best way to solve this is by going to the AndroidManifest.xml: package="com.example.android.yts"
Cursor on example
press
Shift+f6
change Package name eg. example to boss
Click on refactor now `"com.boss.android.yts"``
2nd thing
open build.gradle (module:app) change applicationId "com.example.android.yts"
to "com.boss.android.yts"
The error message is telling it all. You need to use a package name of your own. The package name is the identitiy of the application.
To rename the package name, In eclipse right click on the project in project explorer. Then Android Tools > rename Aplication Package name. Then enter the new package name.
Also make sure that you are trying to upload a release build
Yes, com.example is the default package name for Android applications and is, as such, just a placeholder. You should replace it by a unique package name before uploading it to the Google Play Store. It doesn't particularly matter what it is, but it should relate to your application, cannot match any existing package name (so picking someone else's package name like com.android is not a good idea), and cannot be changed after publishing.
Double-tap **package** from AndroidManifest.xml, refactor-> rename.
Go to build.gradle and change applicationId under defaultConfig.
If you have google-services.json, go to google-services.json and rename package_name in two places.
That should work.
Write something else than the com.example
for ex:
com.gg.s etc will do(make that onj your name/firm name)

Categories

Resources