离子发布:Android 包无法构建

Posted

技术标签:

【中文标题】离子发布:Android 包无法构建【英文标题】:Ionic release : Android package can not build 【发布时间】:2018-08-16 12:46:17 【问题描述】:

我们正在尝试为 android 商店的新版本构建一个 apk 包。 我们收到以下错误: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processReleaseManifest'. > Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] /usr/src/app/platforms/android/CordovaLib/build/intermediates/manifests/full/release/AndroidManifest.xml as the library might be using APIs not available in 16 Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 19, or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 1m 52s 23 actionable tasks: 23 executed (node:1) UnhandledPromiseRejectionWarning: Error: /usr/src/app/platforms/android/gradlew: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. /usr/src/app/platforms/android/app/src/main/AndroidManifest.xml:37:5-74 Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] /usr/src/app/platforms/android/CordovaLib/build/intermediates/manifests/full/release/AndroidManifest.xml as the library might be using APIs not available in 16 Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 19, or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures) FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processReleaseManifest'. > Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] /usr/src/app/platforms/android/CordovaLib/build/intermediates/manifests/full/release/AndroidManifest.xml as the library might be using APIs not available in 16 Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 19, or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 1m 52s at ChildProcess.whenDone (/usr/src/app/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我们不知道原因,并尝试使用 ionic 仪表板对其进行调试,但未成功。 谢谢

【问题讨论】:

【参考方案1】:

在 ionic 项目的 config.xml 中将 android-minSdkVersion 增加到 19。

<preference name="android-minSdkVersion" value="19" />

【讨论】:

以上是关于离子发布:Android 包无法构建的主要内容,如果未能解决你的问题,请参考以下文章

离子+快车道 | Android“错误:包android.support.v4.content不存在”

无法在终端中构建应用程序,只能使用 Android Studio。 (离子,科尔多瓦)

离子科尔多瓦构建错误无法解析配置':classpath'的所有工件无法下载com.android.tools.build:builder:3.3.0

离子包构建失败 - 离子角度工具包

“离子cordova运行android”无法使用cordova-android@7.0.0

离子构建Android |错误:未找到已安装的构建工具。请安装 Android 构建工具