问题描述
升级到Android Studio 3.1之后,我在构建过程中开始出现以下错误.您会在错误中注意到,Project使用multidex并默认启用了DX.我试图检查依赖关系图以了解发生了什么,但是到目前为止还没有任何线索.有趣的是,这只会在我的机器上失败.我清理了所有内容,包括重新安装等,但没有任何效果.
After upgrading to Android Studio 3.1, I started to get following error during build. Project uses multidex and DX is enabled by default as you would notice in the error. I tried to check dependency graph to understand what is going on but so far have no clue. Interestingly this only fails on my machine. I cleaned up everything, including reinstall etc but nothing worked.
任何人都有相同的问题,您是如何解决的?还是我可以看的任何方向?
Anyone had the same issue and how did you solve it? Or any direction that I can take a look?
AGPBI: {
"kind":"error",
"text":"Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat",
"sources":[{}],
"tool":"D8"
}
这是失败的任务:
transformDexArchiveWithExternalLibsDexMergerForDebug
我检查了类似的问题,似乎随机的东西可以解决他们的问题,我不确定真正的原因是什么.
I checked similar issues and it seems random things fixes their problem, I'm not sure what is the real cause.
推荐答案
我设法通过使用以下步骤来确定根本原因.每个问题的用例可能不同,因此这是确定根本原因的方法.
I managed to determine the root cause by using the following steps. It may be different use case for each issue, therefore this is the way to determine the root cause.
- 转到android studio
- 导航->类
- 检查
include non-project classes
- 使用程序包名称复制粘贴完整的类路径.
android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat
- 您应该能够看到它的使用位置.很有可能您可能需要将它们从其中之一中删除.
- Go to android studio
- Navigate -> Class
- Check
include non-project classes
- Copy paste full class path with package name.
android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat
- You should be able to see where it is used. Most probably you may need to remove it from one of them.
在我的情况下,问题是ViewPagerIndicator库正在将支持库下载为jar.删除它可以解决问题.
In my case the issue was ViewPagerIndicator library was downloading support library as jar. Removing it solved the issue.
这篇关于错误:程序类型已存在:android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!