In an Android studio library project, the following code piece gives error.
package my.package.a;
import my.package.b.Test; //this shows unused, why??
public class **Test** extends my.package.b.Test { //"Test is already defined in this compilation unit." why?
...
}
extends my.package.b.Test
this line is using package b, isn't it? so why the import statement shows unused?
These two Test
classes are in different packages, why does it have name conflicts??
Solution:
import
statement.my.package.b.Test
as it's in conflict with current class name.The import is not needed here because you're already calling out my.package.b.Test
by full name. If you use the fully qualified reference to a symbol, there is no need to import it.