gradle build finished with 61 error in 6s 125ms 是啥错误原因
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gradle build finished with 61 error in 6s 125ms 是啥错误原因相关的知识,希望对你有一定的参考价值。
参考技术A 错误:Gradlebuildfinishedwith1error(s)in33secUnexpectedErrorLocalpathdoesn'texist.Localpathdoesn'texist.TheprojectmayneedtobesyncedwithGradlefiles.找到的法:sdk\tools\lib\find_java.bat文件中多个空格或冗余这个版本androidSDKTools的find_java.bat有问题,多了个空格查看没有以上问题,还有什么解决方法,Android将library项目打包成jar文件
1 >>> File - new Module - Android Library - finish
这样就创建了一个library项目。
这里比较libaray/build.gradle与application/build.gradle的不同之处,很清楚,就不多说了。
libaray/build.gradle
1 apply plugin: ‘com.android.library‘ 2 3 android { 4 compileSdkVersion 21 5 buildToolsVersion "21.1.2" 6 7 defaultConfig { 8 minSdkVersion 15 9 targetSdkVersion 21 10 versionCode 1 11 versionName "1.0" 12 } 13 buildTypes { 14 release { 15 minifyEnabled false 16 proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.pro‘ 17 } 18 } 19 } 20 21 dependencies { 22 compile fileTree(dir: ‘libs‘, include: [‘*.jar‘]) 23 compile ‘com.android.support:appcompat-v7:21.0.3‘ 24 }
application/build.gradle
1 apply plugin: ‘com.android.application‘ 2 3 buildscript { 4 repositories { 5 jcenter() 6 } 7 8 dependencies { 9 classpath ‘com.android.tools.build:gradle:1.0.0‘ 10 } 11 } 12 13 repositories { 14 jcenter() 15 } 16 17 dependencies { 18 compile fileTree(dir: ‘libs‘, include: ‘*.jar‘) 19 compile project(‘:library‘) 20 } 21 android { 22 compileSdkVersion 21 23 buildToolsVersion "21.1.2" 24 25 sourceSets { 26 main { 27 manifest.srcFile ‘AndroidManifest.xml‘ 28 java.srcDirs = [‘src‘] 29 res.srcDirs = [‘res‘] 30 assets.srcDirs = [‘assets‘] 31 } 32 } 33 }
找到新建的library目录下的buidle.gradle,在末尾添加:
1 //task to delete the old jar 2 task deleteOldJar(type: Delete) { 3 delete ‘release/AndroidPlugin.jar‘ 4 } 5 6 //task to export contents as jar 7 task exportJar(type: Copy) { 8 from(‘build/intermediates/bundles/release/‘) 9 into(‘release/‘) 10 include(‘classes.jar‘) 11 ///Rename the jar 12 rename(‘classes.jar‘, ‘AndroidPlugin.jar‘) 13 } 14 15 exportJar.dependsOn(deleteOldJar, build)
然后sync Now 或者 sync gradle message。
点击展开mylibrary,找到exportJar,双击开始打包。
最后jar包存放的路径在 reslease 文件夹
文章原文引用如下
https://blog.csdn.net/onlysnail/article/details/45123837#
以上是关于gradle build finished with 61 error in 6s 125ms 是啥错误原因的主要内容,如果未能解决你的问题,请参考以下文章
Android Gradle 编译错误Java finished with non-zero exit value 2
Android-finished with non-zero exit value 2
Android-AndroidStudio莫名其妙的错误-finished with non-zero exit value 1