简体   繁体   English

具有相同名称的两个导入冲突

[英]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.

相关问题 新:程序包与同名的现有程序包冲突 - NEW : the package conflicts with an existing package by the same name 包与同名的现有包冲突 - package conflicts with an existing package by the same name Android - 程序包与现有程序包的名称相同 - Android - The package conflicts with an existing package by the same name Unity3D 包与同名包冲突 - Unity3D Package Conflicts with Package by the Same Name 程序包与同名的现有程序包冲突(不建议卸载) - Package conflicts with an existing package by the same name(Not prefare to Uninstall) Android应用程序在同一设备上有多个APK“…程序包与同名的现有程序包冲突。” - Android Application multiple APKs on same device “…package conflicts with an existing package by the same name.” 如果 Sqlite 和 Room 都存在于同一个项目中,Android 中的数据库名称相同,会不会有冲突? - Will there be any conflicts if Sqlite and Room both exist in same project with same db name in Android? Gettting“未安装Android应用程序。 在安装新版本时,软件包与现有软件包的名称相同 - Gettting “Android App Not Installed. The package conflicts with an existing package by the same name” when installing new version 如果生成构建存在,则无法安装适用于Android的Crashlytics Beta版本:'该软件包与现有软件包冲突,名称相同' - Crashlytics Beta build for Android will not install if production build exists: 'The package conflicts with an existing package by the same name' 如何检测包名称冲突 - How to detect package name conflicts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM