Google Release error

In Android Studio:

1 REFACTOR traccar to newname
2 FILE / SYNC PROJECT WITH GRADLE FILES (sucess)
3 new file google-services.json (corresponding to the new package)
4 TOOLS / FIREBASE - CLOUD MESSAGE (success)
5 GRADLE SCRIPTS - updated successfully.
6 BUILD / REBUILD PROJECT (success)

When trying to generate Google Release the following errors occur (any tips to fix it?):

e: file:///F:/RASTREAMENTO/manager/2024/4.2.g/traccar-manager-android-4.2/app/src/google/java/org/traccar/manager/ManagerMessagingService.kt:37:35 Unresolved reference: MainActivity

e: file:///F:/RASTREAMENTO/manager/2024/4.2.g/traccar-manager-android-4.2/app/src/google/java/org/traccar/manager/ManagerMessagingService.kt:40:66 Unresolved reference: R

e: file:///F:/RASTREAMENTO/manager/2024/4.2.g/traccar-manager-android-4.2/app/src/google/java/org/traccar/manager/ManagerMessagingService.kt:41:27 Unresolved reference: R

e: file:///F:/RASTREAMENTO/manager/2024/4.2.g/traccar-manager-android-4.2/app/src/google/java/org/traccar/manager/ManagerMessagingService.kt:42:40 Unresolved reference: R
Anton Tananaev2 months ago

The problem is likely with "REFACTOR traccar to newname".

Still no success.

Steps:
I loaded traccar manager latest version in Android Studio (latest version)

I changed the package name from "org.traccar.manager" to "org.newname.manager" in:
StartFragment
MainActivity
MainFragment
SecurityManager
build.gradle(applicationId and namespace)

Updated buildscript

buildscript {
 ext.kotlin_version = '1.9.24'
 repositories {
 Google()
 mavenCentral()
 }
 dependencies {
 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
 classpath 'com.android.tools.build:gradle:8.5.1'
 classpath 'com.google.gms:google-services:4.4.2'
 classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
 }
}

SYNC PROJECT
BUILD CLEAN PROJECT [SUCCESS]
BUILD REBUILD PROJECT [SUCCESS]

Successfully generated REGULARRELEASE

When trying to generate GOOGLERELEASE

Imgur

01.png

Anton Tananaev2 months ago

Why would you rename everything? That's exactly the problem.

Hello, I won't give up so easily.
Steps:
Open original project

Manually renamed package in:
ManagerMessagimService
GoogleMainApplication
MainActivity
MainFragment
StartFragment

Renamed with REFACTOR just TRACCAR folder to new name

Renamed package in build.gradle app: applicationID

Clean Project (SUCCESS)
Rebuild Project (presents problem with REFERENCE R (here I have a question. Is it normal for this problem to appear and then I have to import these classes and move on? Or have I already done something wrong in these steps I took?

Remembering that my objective is just to rename the package and get a GOOGLE RELEASE
traccar2.png

Anton Tananaeva month ago

You should not need to rename anything in the code. You just change app id.

Thank you very much Anton
I'll move on.

To resolve the "Unresolved reference" error in Android Studio when generating Google Release in Traccar Manager, follow these steps:

  1. Don't rename all packages: Just change the 'applicationId' in the 'build.gradle' file instead of refactoring all the code.
  2. Check the references to 'R': Make sure that the imports of 'R' are correct and that the 'google-services.json' is in the right place.
  3. Sync and rebuild: After making these changes, sync