My android studio project is compiling as it should, but there's one annoying issue. Android studio gives me this warning:
Package name does not correspond to the file path
The file path declared in the source code is something like com.example.<classes>
but it asks me to rename it to main.src.com.example.<classes>
When I do that, it no longer compiles.
My source code is in the src/main/src
folder.
My build.gradle
contains this
sourceSets {
main {
java.srcDirs = ['src']
}
instrumentTest.setRoot('tests')
}
Rename a package In the Project tool window, click Project and select Packages from the list. IntelliJ IDEA lists all the packages in your project. Right-click the package you want to rename and from the context menu, select Refactor | Rename ( Shift+F6 ).
A module file (the . iml file) is used for keeping module configuration. Modules allow you to combine several technologies and frameworks in one application. In IntelliJ IDEA, you can create several modules for a project and each of them can be responsible for its own framework.
Since your gradle.build file is in the main directory, it views the first src
folder as the one containing the source. Try changing java.srcDirs
to ['src/main/src']
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With