Hocine Elhadj
Hocine Elhadj

Reputation: 105

Generated file for FragmentDirections doesn't have the same package name

I have changed my android app's package name, after clean build and then build I got an error saying : Unresolved reference: data in a generated file (please see the picture below).

I have checked that this file doesn't have the same package name, there is a missing "com" at the beginning (line 1). Also at line 8, there also a missing "com" at the beginning.
I have been struggling with this issue without any luck to find a solution.

Thank you so much Screenshot of the issue

Upvotes: 1

Views: 811

Answers (2)

Logesh R
Logesh R

Reputation: 305

In my case, it was the old version of the navigation library which does not read from the namespace specified in the build.gradle file in app module.

I had to keep the namespace in the manifest file until I upgrade the navigation library.

AndroidManifest.xml looks like this now

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.packagename">

Upvotes: 0

Hocine Elhadj
Hocine Elhadj

Reputation: 105

I found a solution to this problem.

As I mentioned, a generated file was preventing me from building the project after package name refactor even after cleaning and then rebuilding it. I realised that this file has something to do with the navigation graph. So, I opened that file and searched for any leftovers from the previous package name and found it! The refactoring process didn't refactor it all. I changed that and rebuilt the project and all went well.

Upvotes: 1

Related Questions