今天在打包时的时候出现了这个错导致打包不成功,具体原因可以从报错日志中看到是因为studio检测到了lint错误,从而停止了打包。
解决办法是在app
下的build.gradle
文件的android
节点下添加lintOptions{ abortOnError false }
即可,即在检测到lint错误时还接续进行打包。
7:00:55 :app:lint FAILED
17:00:55
17:00:55 FAILURE: Build failed with an exception.
17:00:55
17:00:55 * What went wrong:
17:00:55 Execution failed for task ':app:lint'.
17:00:55 > Lint found errors in the project; aborting build.
17:00:55
17:00:55 Fix the issues identified by lint, or add the following to your build script to proceed with errors:
17:00:55 ...
17:00:55 android {
17:00:55 lintOptions {
17:00:55 abortOnError false
17:00:55 }
17:00:55 }
17:00:55 ...
17:00:55
17:00:55 The first 3 errors (out of 6) were:
17:00:55 /root/.gradle/caches/modules-2/files-2.1/com.alibaba/fastjson/1.2.35/d0b54f814af4652f0893d560d6a785917abdeae1/fastjson-1.2.35.jar: Error: Invalid package reference in library; not included in Android: java.awt. Referenced from com.alibaba.fastjson.serializer.AwtCodec. [InvalidPackage]
17:00:55 /root/.gradle/caches/modules-2/files-2.1/com.alibaba/fastjson/1.2.35/d0b54f814af4652f0893d560d6a785917abdeae1/fastjson-1.2.35.jar: Error: Invalid package reference in library; not included in Android: javax.servlet.http. Referenced from com.alibaba.fastjson.support.spring.FastJsonJsonView. [InvalidPackage]
17:00:55 /root/.gradle/caches/modules-2/files-2.1/com.alibaba/fastjson/1.2.35/d0b54f814af4652f0893d560d6a785917abdeae1/fastjson-1.2.35.jar: Error: Invalid package reference in library; not included in Android: javax.servlet. Referenced from com.alibaba.fastjson.support.spring.FastJsonJsonView. [InvalidPackage]
谢谢