ANDROID开发之问题积累及解决方案(三)

1.dexDebug ExecException finished with non-zero exit value 2
需要在gradle中配置下面的代码,原因是引用了多个libraries文件

defaultConfig {
multiDexEnabled true
}

2.Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/BackStackState$1.class

原因:在所添加的jar包或aar包中也引用了support-V4,与工程中引用的相冲突
Ctrl+N --> 在搜索框中输入BackStackState --> 查找到所有引用该类的类,这些类即为引起冲突的类
去掉本工程中gradle中用于引用有冲突的包的代码或者将冲突的代码从jar包或aar包中移除,确保一个module中只引用了一份相同的第三方包

3.project sturcture和Project Structure 无论是按快捷键或者是从files中打开都不显示

event log中报:IllegalArgumentException:Multiple entries with same key: Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23) and Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23)

解决办法:先看一下系统配置的SDK的位置和Android Studio所用的路径是否一致,如果不一致重新配置系统的SDK路径或者是重新修改Android Studio的SDK路径
通过SDK Manager删除掉google API23
如果解决不了,卸载android studio -->重新安装 ,还有问题点击File --> Invalidate Cashes/Restart --> Invalidate and Restart,解决不了继续通过SDK Manager删除掉google API23
原文地址:https://www.cnblogs.com/squirrel-king/p/6485587.html