[英]Two Imports with same name conflicts
I am trying to use apphance for beta testing. 我正在尝试使用装置进行beta测试。
I need to 我需要
import com.apphance.android.common.Configuration;
but I am already using 但我已经在用
import android.content.res.Configuration;
which conflicts with the other import. 与其他导入冲突。 How do I resolve it?
我该如何解决?
You don't import one of them. 您不会导入其中之一。
When referring to 2 classes that have the same name, only one can be imported. 当引用两个具有相同名称的类时,只能导入一个。 The second one needs to be referred to by it's fully qualified name, like so:
第二个需要使用全限定名来引用,如下所示:
import android.content.res.Configuration;
[...]
// This is android.content.res.Configuration
Configuration config = ...;
// This is com.apphance.android.common.Configuration
com.apphance.android.common.Configuration conf = ...;
Just add this import: 只需添加此导入:
import android.content.res.Configuration;
and like selvin says use Fully Qualified Class Name for the second Configuration
class. 就像selvin说的那样,将完全合格的类名用于第二个
Configuration
类。
com.apphance.android.common.Configuration configuration = new Configuration...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.