0

I am trying to resolve and invalid package name currently my package looks like this:

-com

--domain

---app

----domain

so the package name is com.domain.app.domain

It needs to be com.domain.app, I have tried to move the contents of ----domain, into ---app but I get an IOException and am told certain directories cannot be moved?

I first get warnings Multiple directories correspond to package, these directories will be moved and all references changed, I select 'Yes', I then select refactor and I see the refactoring preview, I select do refactor and I get java.io.IOException: Cannot move 'and the a reference to the first directory here'.

How else can I resolve this, if I cannot move the files or delete the package?

user15348067
  • 43
  • 1
  • 5

1 Answers1

0

I think you would find it quicker/simpler to move them manually and replace the package names using a 'Find/Replace in file' tool:

  1. use the file manager/explorer to move the contents of com/domain/app/domain into com/domain/app and delete the now empty 'domain' leaf directory

  2. use the find/replace in files function (in any decent text editor) to replace 'package com.domain.app.domain' with 'package com.domain.app' in all your source files.

  3. change the applicationId in app/build.gradle & AndroidManifest.xml (if you want to - they don't need to be identical to the actual package name in the sources)

  4. Get back to what you actually wanted to do ...

I've always found that the refactor in AS more trouble than it's worth.

Crispert
  • 1,102
  • 7
  • 13
  • I have a lot of files! I think you are probably correct though at this point. Time to get a coffee and settle in for a Find/Replace Session Thanks. – user15348067 Mar 22 '21 at 12:41