question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to change the package name of an existing project

See original GitHub issue

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 8018.4.34f1
  • Firebase Unity SDK version:

Not exactly sure. But Firebase/Editor/AppDependencies.xml contain following lines:

<iosPod name="Firebase/Core" version="5.16.0" minTargetSdk="8.0">
<androidPackage spec="com.google.firebase:firebase-common:16.0.4">
<androidPackage spec="com.google.firebase:firebase-core:16.0.7">
<androidPackage spec="com.google.firebase:firebase-app-unity:5.5.0">
  • Source you installed the SDK: unitypackage
  • Additional SDKs you are using: AdMob
  • Platform you are using the Unity editor on: Linux
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the question here:

I’m preparing a premium version of an existing android application. And I just need to rename the package name in my Unity Android project.

The steps I followed prior to update the package name in Unity Player Settings as follows:

  • Created a new Firebase project with the new package name
  • Downloaded google-services.json
  • While in Unity Editor, backup/renamed the old google-services.json -> google-services-old.json
  • Import the new google-services.json file to the assets folder

After importing the new google-services.json the following error is shown in the console:

Project Bundle ID defaulttm.gravity does not match any bundle IDs in your google-services.json files
This will result in an app that will fail to initialize.

Available Bundle IDs:
gravity.premium

You need to either:
* Fix your app's bundle ID under "Player Settings --> Bundle Identifier"
or:
* Add another app to your firebase project
  Goto https://firebase.google.com/docs/unity/setup#add_firebase_to_your_app_1
  and add the new configuration file to your project.

Then in Player Settings, I set the package name to the new name. Just after I updated package name, I got a prompt saying,

Moving File Failed
Moving Temp/copyassets/google-services.json to Assets/StreamingAssets/google-services-desktop.json

The following lines were shown In the Unity Editor logs:

*** bb0aae3e21fd6af8dbb001d7e2ab7b71 replaces 4bac85f7aece20724ba43e10e0c3b86b at path assets/streamingassets/google-services-desktop.json 
Updating Assets/StreamingAssets/google-services-desktop.json - GUID: bb0aae3e21fd6af8dbb001d7e2ab7b71...

After canceling the ‘Move file failed’ prompt, Unity starts resolving Android dependencies.

After the resolving is completed, the following files are being changed in the project:

Changes not staged for commit:
        modified:   .idea/.idea.gravity-x/.idea/workspace.xml
        modified:   Assets/Plugins/Android/Firebase/res/values/google-services.xml
        deleted:    Assets/Plugins/Android/androidx.arch.core.core-common-2.0.0.jar
        deleted:    Assets/Plugins/Android/androidx.arch.core.core-common-2.0.0.jar.meta
        deleted:    Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.0.aar
        deleted:    Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.0.aar.meta
        deleted:    Assets/Plugins/Android/androidx.core.core-1.0.0.aar
        deleted:    Assets/Plugins/Android/androidx.core.core-1.0.0.aar.meta
        deleted:    Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.0.0.aar
        deleted:    Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.0.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-19.1.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-19.1.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-19.1.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-19.1.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-19.1.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-19.1.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-base-17.0.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-base-17.0.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.0.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.0.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-gass-19.1.0.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-gass-19.1.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-api-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-api-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-analytics-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-analytics-17.4.3.aar.meta
        modified:   Assets/Plugins/Android/com.google.firebase.firebase-analytics-unity-5.5.0.aar
        modified:   Assets/Plugins/Android/com.google.firebase.firebase-app-unity-5.5.0.aar
        modified:   Assets/Plugins/Android/com.google.firebase.firebase-common-19.3.0.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-core-17.4.3.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-core-17.4.3.aar.meta
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-iid-20.1.5.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-iid-20.1.5.aar.meta
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-17.0.0.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-17.0.0.aar.meta
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-installations-16.2.1.aar
        deleted:    Assets/Plugins/Android/com.google.firebase.firebase-installations-16.2.1.aar.meta
        modified:   Assets/StreamingAssets/google-services-desktop.json
        modified:   Assets/StreamingAssets/google-services-desktop.json.meta
        modified:   Assets/google-services.json
        modified:   Assets/google-services.json.meta
        modified:   ProjectSettings/AndroidResolverDependencies.xml
        modified:   ProjectSettings/ProjectSettings.asset

Untracked files:
        Assets/Plugins/Android/androidx.arch.core.core-common-2.0.1.jar
        Assets/Plugins/Android/androidx.arch.core.core-common-2.0.1.jar.meta
        Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.1.aar
        Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.1.aar.meta
        Assets/Plugins/Android/androidx.core.core-1.2.0.aar
        Assets/Plugins/Android/androidx.core.core-1.2.0.aar.meta
        Assets/Plugins/Android/androidx.lifecycle.lifecycle-service-2.0.0.aar
        Assets/Plugins/Android/androidx.lifecycle.lifecycle-service-2.0.0.aar.meta
        Assets/Plugins/Android/androidx.room.room-common-2.1.0.jar
        Assets/Plugins/Android/androidx.room.room-common-2.1.0.jar.meta
        Assets/Plugins/Android/androidx.room.room-runtime-2.1.0.aar
        Assets/Plugins/Android/androidx.room.room-runtime-2.1.0.aar.meta
        Assets/Plugins/Android/androidx.sqlite.sqlite-2.0.1.aar
        Assets/Plugins/Android/androidx.sqlite.sqlite-2.0.1.aar.meta
        Assets/Plugins/Android/androidx.sqlite.sqlite-framework-2.0.1.aar
        Assets/Plugins/Android/androidx.sqlite.sqlite-framework-2.0.1.aar.meta
        Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.1.0.aar
        Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.1.0.aar.meta
        Assets/Plugins/Android/androidx.work.work-runtime-2.1.0.aar
        Assets/Plugins/Android/androidx.work.work-runtime-2.1.0.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-20.1.0.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-20.1.0.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-20.1.0.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-20.1.0.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-20.1.0.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-20.1.0.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-base-16.0.1.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-base-16.0.1.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.6.0.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.6.0.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-api-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-api-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-impl-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-18.0.3.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.android.ump.user-messaging-platform-1.0.0.aar
        Assets/Plugins/Android/com.google.android.ump.user-messaging-platform-1.0.0.aar.meta
        Assets/Plugins/Android/com.google.firebase.firebase-analytics-18.0.3.aar
        Assets/Plugins/Android/com.google.firebase.firebase-analytics-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.firebase.firebase-core-18.0.3.aar
        Assets/Plugins/Android/com.google.firebase.firebase-core-18.0.3.aar.meta
        Assets/Plugins/Android/com.google.firebase.firebase-iid-17.0.4.aar
        Assets/Plugins/Android/com.google.firebase.firebase-iid-17.0.4.aar.meta
        Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-16.0.1.aar
        Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-16.0.1.aar.meta
        Assets/Plugins/Android/com.google.firebase.firebase-installations-16.3.2.aar
        Assets/Plugins/Android/com.google.firebase.firebase-installations-16.3.2.aar.meta
        Assets/Plugins/Android/com.google.guava.listenablefuture-1.0.jar
        Assets/Plugins/Android/com.google.guava.listenablefuture-1.0.jar.meta

Then when I tried to build the project, I get the following error:

home/gayanw/Unity/Hub/Editor/2018.4.34f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/Linux/bin/java -classpath "/home/gayanw/Unity/Hub/Editor/2018.4.34f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bundleReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  /home/gayanw/bitbucket/gravity-x/Temp/gradleOut/build/intermediates/bundle_manifest/release/processReleaseManifest/bundle-manifest/AndroidManifest.xml:44: error: unexpected element <queries> found in <manifest>.

BUILD FAILED in 8s
]
stdout[

> Configure project :
WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
The current default is 'true'.

> Configure project :Firebase
WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
The current default is 'true'.

> Configure project :GoogleMobileAdsPlugin
WARNING: The option setting 'android.bundle.enableUncompressedNativeLibs=false' is experimental and unsupported.
The current default is 'true'.

I tried building with target API level set to both 29, and 30 in ‘Player Settings’. But it fails the same error. I really appreciate any help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
patm1987commented, May 11, 2021

Reading through your reported dependencies, I see:

<androidPackage spec="com.google.firebase:firebase-app-unity:5.5.0">

Which would indicate the 5.5.0 SDK (the -unity ones are packages that bind C# to C++, so they match the Unity SDK version). If you update to the latest (7.2.0), the issue may resolve itself (this also explains the lack of androidlib folders).

Since I can’t reproduce the issue locally, it would be useful to know if it’s been resolved in subsequent SDKs or is an issue with your configuration that we should continue to track down and patch.

If updating your project is not feasible or you still see the issue after updating to 7.2.0, it would also be helpful to know if you see this issue in the quickstarts in this repo (such as Analytics) so I know that I’m looking at the same code as you are.

1reaction
patm1987commented, May 10, 2021

Hi @gayanW,

Can you try the following:

  1. close Unity completely (this deletes the Temp/ folder and makes sure that no automated processes get in your way)
  2. delete Assets/StreamingAssets/google-services-desktop.json (this is a file auto-generated for desktop support and looks to be getting in your way)
  3. delete any “Firebase looking” folders in Assets/Plugins/Android/ that end in .androidlib. The ones I can think of are FirebaseApp.androidlib and FirebaseCrashlytics.androidlib. (these files are simulating what the PlayServicesPlugin does on normal Android projects and will be auto-re-generated by the Firebase plugin if they’re missing)
  4. Add your new google-services.json file (renaming as before should be fine, but make sure that you only have a single file named google-services.json in your entire Assets/ directory – the behaviour becomes undefined otherwise)

If you can relaunch and have everything work, this is at least a workaround. If you can isolate which step/steps are necessary for the workaround, that would ensure that we have good visibility into where the actual bug lies and address it accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Rename Package Name in Android Studio?
Step 1: To rename package name in Android studio open your project in Android mode first as shown in the below image. Step...
Read more >
Rename package in Android Studio | Edureka Community
Right-click it · Select Refactor · Click on Rename · In the pop-up dialog, click on Rename Package instead of Rename Directory ·...
Read more >
Change your Project Name & Package Name in Android ...
Contents · Open the settings. · Go to the res folder > values > strings. · To rename your package name, all you...
Read more >
How to change the Package name in Android | by SHISHIR
Right-click it · Select Refactor · Click on Rename · In the Pop-up dialog, click on Rename Package instead of Rename Directory ·...
Read more >
How to change Package name : r/androiddev
I guess you can refactore myname.google very easily.. but if you want to change entire package name then you have to create seperate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found