Android Gradle Build Error:Some file crunching failed, see logs for details解决办法
在主工程文件夹下的build点gradle文件里,加两句:
aaptOptions点cruncherEnabled = false
aaptOptions点useNewCruncher = false
例如:
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
minSdkVersion 5
targetSdkVersion 17
}
然后重新构建、运行
Unsupported major.minor version 52.0
编译Andorid 工程的时候,有时候出现gradle 报下面的错误。
Error:(1, 0) Cause: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
这个错误的原因是在 工程的build.gradle
文件中的gradle 工具配置使用了gradle:+
将它
classpath 'com.android.tools.build:gradle:+'
替换为固定版本的gradle。问题解决
classpath "com.android.tools.build:gradle:2.1.0"
重复引用包问题
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/view/CollapsibleActionView.class
这个问题是因为在工程中既有本地的lib.jar文件,又有compile链接,请确认全部统一即可。
配置忽略文件问题
Error:Execution failed for task ':little_farmer:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES
File1: C:\Users\Administrator\Desktop\test\MyApplication\little_farmer\libs\httpmime-4.3.5.jar
File2: C:\Users\Administrator\Desktop\test\MyApplication\little_farmer\libs\httpcore-4.3.2.jar
File3: C:\Users\Administrator\Desktop\test\MyApplication\little_farmer\libs\httpclient-4.3.5.jar
需要在当前model的build.gradle中配置忽略文件
packagingOptions{
exclude'META-INF/DEPENDENCIES.txt'
exclude'META-INF/LICENSE.txt'
exclude'META-INF/NOTICE.txt'
exclude'META-INF/NOTICE'
exclude'META-INF/LICENSE'
exclude'META-INF/DEPENDENCIES'
exclude'META-INF/notice.txt'
exclude'META-INF/license.txt'
exclude'META-INF/dependencies.txt'
exclude'META-INF/LGPL2.1'
}
使用RxLifecycle反之RxJava内存泄露时导入包之后可能出现的问题:
导包:
compile 'com.trello.rxlifecycle2:rxlifecycle:2.0.1'
compile 'com.trello.rxlifecycle2:rxlifecycle-components:2.0.1'
报错信息:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (3.0.1) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
解决办法:
在 项目的gradle文件 android{}中添加如下配置:
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
导入项目是出现 “Error:SSL peer shut down incorrectly” 错误
我的是修改为下图就可以了(可以对照其他正常项目进行修改)
错误信息
C:\Users\Admin\Desktop\MyApplication\android\app\build.gradle
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (3.0.0) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
解决办法:当前Module的build.gradle中添加如下代码
android {
......
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
错误信息
Error:(4) Error: "pickerview_year" is not translated in "en" (English) [MissingTranslation]
解决办法:
String之类的文件里面 resources 标签内增加 xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation" 即可。
变为
错误信息:Error: Program type already present: com.xxx.xxx.BuildConfig
可能是因为 有2个module在 AndroidManifest.xml 里面具有一样的package name,修改不同名字即可
错误信息:Warning:Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (3.0.1) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
在build.gradle的 Android{ }里添加:
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
错误信息:AGPBI: {"kind":"error","text":"error: resource android:attr/fontVariationSettings not found.
在build.gradle的 Android{ }里添加:
configurations.all {
resolutionStrategy.force "com.android.support:support-v4:27.1.0"
}