gradle与jenkins编译常见报错及解决
一、jenkins编译错误总结1.错误一: /data/jenkins/workspace/tv-child-release/tvApp/libraryPrj/lecore/src/com/letv/core/utils/DevicesUtils.java:1335: error: cannot find symbol
·
一、jenkins编译错误总结
1.错误一:
/data/jenkins/workspace/tv-child-release/tvApp/libraryPrj/lecore/src/com/letv/core/utils/DevicesUtils.java:1335: error: cannot find symbol isSupport = LetvManager.isSupportEyeProtection(); ^ symbol: method isSupportEyeProtection() location: class LetvManager /data/jenkins/workspace/tv-child-release/tvApp/libraryPrj/lecore/src/com/letv/core/utils/DevicesUtils.java:1351: error: cannot find symbol LetvManager.setEyeProtectionMode(context, pictureMode); ^ symbol: method setEyeProtectionMode(Context,int) location: class LetvManager Note: /data/jenkins/workspace/tv-child-release/tvApp/libraryPrj/lecore/src/com/letv/core/timer/LetvTimeFetcher.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 6 errors Incremental compilation of 26 classes completed in 4.407 secs. :libraryPrj:lecore:compileReleaseJavaWithJavac FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':libraryPrj:lecore:compileReleaseJavaWithJavac'. > Compilation failed; see the compiler error output for details. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 2 mins 10.094 secs
第一次构建的时候出的问题,
解决:再编译一次就成功了!
2.错误二:
+ ./gradlew --daemon :tv-letvApp:aCR
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Task 'aCR' is ambiguous in project ':tv-letvApp'. Candidates are: 'assembleCibnRelease', 'assembleCommonRelease'.
解决:更改aCR为assembleCibnRelease!
3.错误三:
* What went wrong:
Execution failed for task ':libraryPrj:payLib:processCibnReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/share/androidsdk/sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 43.329 secs
Build step 'Execute shell' marked build as failure
Sending e-mails to: ${GERRIT_CHANGE_OWNER_EMAIL}@le.com wangrenguang1@le.com
Finished: FAILURE
解决:rm -rf tvApp, 再编译一次!
4.错误四:
FAILURE: Build failed with an exception.
* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Build step 'Execute shell' marked build as failure
Sending e-mails to: ${GERRIT_CHANGE_OWNER_EMAIL}@le.com wangrenguang1@le.com
Finished: FAILURE
解决: 再编译一次就成功了!
5.错误五:
./leChildMasterBuildRelease
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':libraryPrj:payLib:processCibnReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/caiwei/Library/Android/sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 1
解决: Build - clean Project, 再编译一次!
二、gradle编译常见错误总结
1.
Error:Configuration with name 'default' not found.
build.gradle文件依赖设置不正确
2.
Execution failed for task ':leso:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/caiwei/software/install/jdk/jdk1.7.0_67/bin/java'' finished with non-zero exit value 2
包名冲突:如leso和lesoSearchLib都为com.letv.leso 需要修改 并更改各个类R文件的引用
3.
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/view/PagerAdapter;
Error:Execution failed for task ':leso:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/caiwei/software/install/jdk/jdk1.7.0_67/bin/java'' finished with non-zero exit value 2
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.Main.main(Main.java:106)
at com.android.dx.command.dexer.Main.main(Main.java:215)
Error:Execution failed for task ':leso:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/caiwei/software/install/jdk/jdk1.7.0_67/bin/java'' finished with non-zero exit value 2
原因:libs/下的android support v4包重复
4.
Error:A problem occurred configuring project ':leso'.
> A problem occurred configuring project ':libraryPrj:lesoSearchLib'.
> A problem occurred configuring project ':libraryPrj:letvCore'.
> Could not resolve all dependencies for configuration ':libraryPrj:letvCore:_debugCompile'.
> Could not resolve pl.droidsonroids.gif:android-gif-drawable:1.1.+.
Required by:
LetvApp.libraryPrj:letvCore:unspecified
> No cached version listing for pl.droidsonroids.gif:android-gif-drawable:1.1.+ available for offline mode.
> No cached version listing for pl.droidsonroids.gif:android-gif-drawable:1.1.+ available for offline mode.
原因: Settings--Gradle--Global Gradle settings -- Offline work(打了勾)
5.
Warning: can't write resource [bin/AndroidManifest.xml] (Duplicate zip entry [imageloader_1.9.3_forbid_longconnect.jar:bin/AndroidManifest.xml])
:leso:dexRelease
:leso:processReleaseJavaRes UP-TO-DATE
:leso:shrinkReleaseResources
Removed unused resources: Binary resource data reduced from 8367KB to 8253KB: Removed 1%
Note: If necessary, you can disable resource shrinking by adding
android {
buildTypes {
release {
shrinkResources false
}
}
}
:leso:validateReleaseSigning
:leso:packageReleaseError: duplicate files during packaging of APK /data/jenkins/workspace/tv-client-leso/client/LetvApp/leso/build/outputs/apk/leso-release-unaligned.apk
Path in archive: bin/AndroidManifest.xml
Origin 1: /data/jenkins/workspace/tv-client-leso/client/LetvApp/leso/libs/pluginframework.jar
Origin 2: /data/jenkins/workspace/tv-client-leso/client/LetvApp/leso/build/intermediates/exploded-aar/LetvApp.libraryPrj/letvCore/unspecified/libs/imageloader_1.9.3_forbid_longconnect.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'bin/AndroidManifest.xml'
}
}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':leso:packageRelease'.
> Duplicate files copied in APK bin/AndroidManifest.xml
File 1: /data/jenkins/workspace/tv-client-leso/client/LetvApp/leso/libs/pluginframework.jar
File 2: /data/jenkins/workspace/tv-client-leso/client/LetvApp/leso/libs/pluginframework.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2 mins 24.385 secs
+ exit $'1\357\274\233'
/tmp/hudson579191790894082888.sh: line 30: exit: 1;: numeric argument required
Build step 'Execute shell' marked build as failure
Sending e-mails to: xianggengping@letv.com caiwei@letv.com
Finished: FAILURE
在这它在抱怨重复在同一个文件,这是不同于其他类似的错误。这些都是我不适用情形:
android {
packagingOptions {
exclude 'bin/AndroidManifest.xml'
}
}
6.
- 1
- 2
- 1
- 2
报错大概的意思是说,添加了重复的Suppot/v4包,看了项目libs中已经有个v4,发现Project A中也引用了v4包 compile ‘com.
Android
.support:support-v4:19.0.1’,
解决:
compile (project(':A')) { exclude module: 'support-v4'}
更多推荐
已为社区贡献1条内容
所有评论(0)