Gradle build finished with 1 error(s) in 15s 197m

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle build finished with 1 error(s) in 15s 197m相关的知识,希望对你有一定的参考价值。

Gradle build finished with 1 error(s) in 15s 197ms请问大神这是什么意思 怎么处理啊

Gradle build finished with 1 error(s) in 15s 197ms

Gradle建立了1错误(S)在15秒197ms

重点词汇

build建立; 建造,构筑; 开发; 为…建立基础; 建造,营造; 扩大,扩展; 发展,达到; 体格,构造; 〈俚〉优美的体型,肉体美

finished完成了的; 技术高超的; 精湛的; 〈俚〉完蛋了的; 结束,完成( finish的过去式和过去分词)

with随着; 和,跟; 关于; 和…一致

error错误,过失; 误差

相关问题的解决方法:(每台计算机运行环境不相同,以下方法仅供参考)

Gradle build finished with 1 error(s) in 15s 197ms,无法编译生成apk,就是build-tool版本低了,比sdk版本低。需要升级了build-tool工具。

那么如何升级了,打开sdkManager.exe工具,找到tool项下的build-tool,可对其进行升级

希望对你有帮助

参考技术A Gradle build finished with 1 error(s) in 15s 197m

Gradle建立了1错误(S)在15秒197m

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 1 error(s) in 15s 197m的主要内容,如果未能解决你的问题,请参考以下文章

Android Gradle 编译错误Java finished with non-zero exit value 2

Android将library项目打包成jar文件

AndroidStudio中导入module(超详细)

Android-finished with non-zero exit value 2

Android-AndroidStudio莫名其妙的错误-finished with non-zero exit value 1

ndk-build.cmd‘‘ finished with non-zero exit value 2