转载-android studio 各种问题
android studio 各种问题
1.dexDebug ExecException finished with non-zero exit value 2 全bug日志如下:
(Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\JDK8\jdk1.8.0_11\bin\java.exe'' 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
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/annotation/ArrayRes.class
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/ServerError.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
4.
Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\DJIgo\app\build\intermediates\res\merged\debug
项目中有错,无法删除这个文件夹下面的文件。手动删除debug文件夹或某工具粉碎即可(补充与20160916)。
5.
Error:Execution failed for task ':tongyan_bugs_framework_master:processDebugAndroidTestManifest'.
>
java.lang.RuntimeException: Manifest merger failed :
uses-sdk:minSdkVersion 18 cannot be smaller than version 19 declared in
library [DJIgo:tysubwayinspection3.0-framework:unspecified]
E:\as_workspaces\DJIgo\tongyan_bugs_framework_master\build\intermediates\exploded-aar\DJIgo\ty3.0-framework\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.ton.framework" to force usage
应该是Library的sdk的版本与app的sdk的版本有冲突
6.
Error:Execution failed for task ':app:processDebugManifest'.
>
Manifest merger failed : uses-sdk:minSdkVersion 17 cannot be smaller
than version 19 declared in library
[DJIgo:tongyan-djigo-lib:unspecified]
E:\as_workspaces\DJIgo\app\build\intermediates\exploded-aar\DJIgo\tongyan-djigo-lib\unspecified\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.tongyan.lib.djigo" to force usage
7.
Error:Execution failed for task ':tongyan-djigo-lib:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
8.
注: E:\as_workspaces\DJIgo\tongyan-djigo-lib\src\main\java\com\tongyan\lib\djigo\ui\view\ControlMoveView.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 android studio-File->Project Structure->Android sdk location(路径应该不正确)
9.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.io.FileNotFoundException: E:\as_workspaces\TYSubway\app\libs\pushservice-4.5.6.88.jar (系统找不到指定的文件。)
需要把dependencies中的lib包下面的jar包全部取消下,再添加。
10.
Error:Execution failed for task ':tysubwayinspection3.0-framework:packageReleaseResources'.
>
java.io.IOException: Could not delete folder
E:\as_workspaces\DJIgo\tysubwayinspection3.0-framework\build\intermediates\bundles\release\res
11.由于使用sdk5.0造成的以下问题,需要用sdk6.0
E:\as_workspaces\DJIgo\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(3)
Error retrieving parent for item: No resource found that matches the
given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(18)
Error retrieving parent for item: No resource found that matches the
given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
>
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'D:\Android\adt-bundle-windows-x86_64-20140702\android_sdk\build-tools\23.0.0\aapt.exe''
finished with non-zero exit value 1
12.
Error:Execution failed for task ':app:clean'.
> Unable to
delete file:
E:\as_workspaces\DjiGo-Demo\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\classes.jar
项目中有错
13.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/annotation/IntegerRes.class
包冲突了,在app及子library中仔细找是否有相同的jar包
14.
Error:Execution failed for task ':app:clean'.
> Unable to delete directory: E:\as_workspaces\DJIGO_FLY\app\build\outputs\apk
无法删除这个文件夹下的文件,到目录下面就知道了。
15.
关于R文件无法引入,导致很长时间无法找到错误的根源。比如:如果错误在A类里面发生,但是Message里提示的是B类的R文件无法引入。
这样你就要用排除法,就像做选择题,要将B类的问题先注释掉,A类里面的问题才会暴露出来。
16. 2016-07-04
关于该问题,需要注意的是。有时候虽然有个红叉但是也能运行,可能as校验导致该问题。另外如果代码中没有什么问题时,就需要查看下AndroidManifest.xml是否有错误,一般情况下是这个原因导致。只要知道这个即可。
17.2016-07-04
Error:Execution failed for task ':Tongyan_StructureCheck_Library:clean'.
>
Unable to delete directory:
E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution\StructureCheck_Library\build\intermediates\exploded-aar
按照上面的说明,不能删除这个目录,你就手动删除下
18.2016-07-15
Error:Execution failed for task ':app:clean'.
> Unable to
delete directory:
E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution\app\build\intermediates\classes\debug\com\tongyan\nanjing\subway
Unable to delete directory 像这样不能删除文件,你就找这个这个文件夹删除掉,如果不能删除就粉碎掉。官网的错误提示还是比较傻瓜式的,他让你干嘛,你就干嘛就行了。
19.2016-07-18
Error:(1, 0) Plugin is too old, please update to a more recent
version, or set ANDROID_DAILY_OVERRIDE environment variable to
"ad3f801955f53e94516853b8f93ac2b9ee8cc4"
<a
href="fixGradleElements">Fix plugin version and sync
project</a><br><a
href="openFile:E:\as_workspaces\PedometerDemo\app\build.gradle">Open
File</a>
将该处的配置改成目前能使用的项目的配置
Error:Could not open no_initscript class cache for initialization
script 'C:\Users\Rubert\AppData\Local\Temp\asLocalRepo194.gradle'
(C:\Users\Rubert\.gradle\caches\2.4\scripts\asLocalRepo194_dzs652nv4687n61mc501sfben\InitScript\no_initscript).
>
Failed to create directory
'C:\Users\Rubert\.gradle\caches\2.4\scripts\asLocalRepo194_dzs652nv4687n61mc501sfben\InitScript\no_initscript\classes'
>
com.android.build.api.transform.TransformException: java.lang.RuntimeException:
java.lang.RuntimeException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
java.lang.UnsupportedOperationException
该问题是由于libs导入的v4包版本有问题,后来改成下面就可以了
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/Volley.jar')
compile files('libs/gson-1.7.1.jar')
compile 'com.android.support:support-v4:22.0.0'
} 26.2016.12.26
> Cannot find System JavaCompiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
File-->Project-->Structrue-->SDK Location-->JDK location
Use embedded JDK 前面勾去掉,指定一个JDK地址。
27.2017.1.10
Error:com.android.builder.internal.aapt.AaptException: Failed to crunch file E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution3\Tongyan_StructureCheck_Library\build\intermediates\exploded-aar\TYSubwayInspectionNJ_Reconsitution3\Tongyan_Framework_Library\unspecified\res\drawable-hdpi-v4\np_numberpicker_up_disabled_focused_holo_dark.png into E:\as_workspaces\TYSubwayInspectionNJ_Reconsitution3\Tongyan_StructureCheck_Library\build\intermediates\res\merged\androidTest\debug\drawable-hdpi-v4\np_numberpicker_up_disabled_focused_holo_dark.png
修改名称路径,避免路径过长
28.2017.2.16
当你android:targetSdkVersion="22" 再将22改成23时会遇到各种问题,例如编译不通过,文件无法写入(权限注册过)。把手机上的app删除,再安装即可。
29.2017.2.23
Error:Error converting bytecode to dex:
Cause:
com.android.dex.DexException: Multiple dex files define
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
30.2017.2.24
Error:A problem occurred configuring project ':app'.
> Unable to find optional library: org.apache.http.legacy
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'com.xxx.xxxe'
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
useLibrary 'org.apache.http.legacy'
}
31.2017-03-08
Error:Execution failed for task ':app:compileReleaseJava'.
>
Cannot find System Java Compiler. Ensure that you have installed a JDK
(not just a JRE) and configured your JAVA_HOME system variable to point
to the according directory.
将此处的勾选去掉,再改成你的jdk根目录
32.
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/net/DatagramSocketClient;
clean
33.2017-04-28
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
>
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
java.lang.UnsupportedOperationException
同第25.
34.2017-04-28
android API23 无法使用HttpClient无法使用,在build.gradle文件中加入下面代码即可
android {
useLibrary "org.apache.http.legacy"
}
35.2017-07-06
Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
该问题主要是你Gradle版本不对,在当前正常能运行的项目中File->Project
Structure->Project->gradle version
(2.14.1),将该版本设置到你不能运行的项目中的相同位置。然后,就没有然后了。
转载-android studio 各种问题的更多相关文章
- [转载] Android Studio 上第一个 Xposed 模块
本文转载自: http://www.open-open.com/lib/view/open1451364108964.html 环境: 已root手机一枚 Android Studio一枚 官方文档参 ...
- [转载]Android Studio卡在refreshing gradle project的原因和快速解决办法
转载请注明出处:http://blog.csdn.net/u013005791/article/details/60143750 这个问题遇到过很多次,网上也有很多解决办法,但是好像都没有发现refr ...
- Android Studio 环境部署 (转载)
Android Studio的安装和使用过程经常需要下载以来文件和Gradle版本,而Google网站在天朝的访问可谓步履维艰,没有稳定的FQ工具是非常痛苦的.何况,作为一个优秀的程序员,不能访问国外 ...
- 转载:Android Studio 快捷键
Android Studio使用技巧系列教程(一) 分类: android studio2015-07-08 10:04 4774人阅读 评论(6) 收藏 举报 android开发ideandroid ...
- 【转载】Android Studio 导入External Libraries
转载: 世军 Android Studio 导入External Libraries http://www.cnblogs.com/shijunzhang/p/5625432.html 导入本地Li ...
- <杂记>Android Studio 3.0-3.1 汉化包 (转载)
JetBrains 系列软件汉化包 关键字: Android Studio 3.0-3.1 汉化包 CLion 2018.1 汉化包 GoLand 2017.3.2-2018.1 汉化包 Intell ...
- [Android Studio] Android Studio如何查看branch列表及切换branch(转载)
转载地址:http://blog.csdn.net/hyr83960944/article/details/36185231 用Git bash去切换相信大家都会,一行命令行搞定的问题.而在Andro ...
- [Android Studio] Android Studio如何删除module(转载)
转载地址:http://blog.csdn.net/hyr83960944/article/details/37519299 当你想在Android Studio中删除某个module时,大家习惯性的 ...
- (转载) android studio library生成jar包和aar的方法总结
android studio library生成jar包和aar的方法总结 标签: android学习文档jar和aar的使用与生成gradle 2016-11-25 10:39 1782人阅读 评论 ...
随机推荐
- [CF98E]Help Shrek and Donkey
题意:A和B两个卡牌大师玩游戏,A有$n$张牌,B有$m$张牌,桌上有$1$张牌,这$n+m+1$张牌互不相同且A和B都知道这些牌里有什么牌(但他们互相不知道对方有什么牌,两个人也都不知道桌上的那张牌 ...
- python3 开发面试题(%s和format的区别)5.31
在格式化字符串中有两种方法: 1.%s 2.format 大家常用的是哪一种方法?为什么要用你选的这种方法? 我们先看一个例子: 首先我们定义一个我军需要击杀的恐怖分子的地理坐标为 c=(128,12 ...
- 【R笔记】order函数例子
问题: R中提供的例子不太懂,为什么得出的结果是6 5 2 1 7 4 10 8 3 9呢? (ii <- order(x <- c(1,1,3:1,1:4,3), y & ...
- Scala实战高手****第13课:Scala模式匹配实战和Spark源码鉴赏
package com.dt.spark.scala.bascis class Dataframework case class Computerframework (name:String,popu ...
- SweetAlert和MBProgressHUD冲突的解决办法
解决方法 : UIView *view = [UIApplication sharedApplication].keyWindow; NSLog(@" -- &g ...
- asp.net 视图引擎归类
1. ASPX View Engine 第一个也是我们最熟悉的---aspx,相信做过WebForm开发对Aspx都比较了解: 小示例: <%@ Control Inherits="S ...
- linux下获取占用CPU资源最多的10个进程
linux下获取占用CPU资源最多的10个进程,可以使用如下命令组合: ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head linux下获取占用 ...
- elasticsearch term 查询二:Range Query
Range Query 将文档与具有一定范围内字词的字段进行匹配. Lucene查询的类型取决于字段类型,对于字符串字段,TermRangeQuery,对于数字/日期字段,查询是NumericRang ...
- 怎样在caffe中添加layer以及caffe中triplet loss layer的实现
关于triplet loss的原理.目标函数和梯度推导在上一篇博客中已经讲过了.详细见:triplet loss原理以及梯度推导.这篇博文主要是讲caffe下实现triplet loss.编程菜鸟.假 ...
- 查看某一个开发者代码修改量的脚本(ios平台可用)
#!/bin/sh # This is a script that help you get your team member's productivity # by analyzing his/he ...