cordova构建minsdkversion错误

问题描述 投票:1回答:1

我在尝试构建一个没有额外插件的空phonegap项目时遇到了一个奇怪的错误

Error: /home/arjun/Desktop/phone/goodbackup/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/arjun/Desktop/phone/goodbackup/platforms/android/app/src/main/AndroidManifest.xml:16:5-74 Error:
    uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [:CordovaLib] /home/arjun/Desktop/phone/goodbackup/platforms/android/CordovaLib/build/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 14
    Suggestion: use a compatible library with a minSdk of at most 14,
        or increase this project's minSdk version to at least 16,
        or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)

我尝试将config.xml和android清单xml编辑到版本16,但它仍然抛出相同的Build Failed错误

使用Phonegap 7.1.1。我之前没有建立应用程序的问题,现在意外地抛出了这个错误。

插件列表

>$ phonegap plugin list
cordova-plugin-battery-status 1.2.5 "Battery"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-dialogs 1.3.4 "Notification"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-globalization 1.0.9 "Globalization"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-media-capture 1.4.3 "Capture"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-vibration 2.1.6 "Vibration"

记录输出

>$ phonegap  build android
[phonegap] executing 'cordova build android ' ...
Android Studio project detected


ANDROID_HOME=/home/arjun/Android/Sdk

JAVA_HOME=/usr/lib/jvm/java-8-oracle

studio

Subproject Path: CordovaLib

Subproject Path: app

publishNonDefault is deprecated and has no effect anymore. All variants are now published.


The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.


    at build_7cm3aseye2nga2tboifwbh2f7.run(/home/arjun/Desktop/phone/goodbackup/platforms/android/app/build.gradle:143)


Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.


:CordovaLib:preBuild

UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript
 UP-TO-DATE

:CordovaLib:checkDebugManifest
 UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources
 UP-TO-DATE

:CordovaLib:platformAttrExtractor
 UP-TO-DATE

:CordovaLib:processDebugManifest
 UP-TO-DATE

:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE

:CordovaLib:compileDebugJavaWithJavac
 UP-TO-DATE

:CordovaLib:processDebugJavaRes
 NO-SOURCE

:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
 UP-TO-DATE

:app:preBuild
 UP-TO-DATE

:app:preDebugBuild
 UP-TO-DATE

:app:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript
 NO-SOURCE

:app:compileDebugRenderscript
 UP-TO-DATE

:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig
 UP-TO-DATE

:app:prepareLintJar
 UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
 UP-TO-DATE

:app:createDebugCompatibleScreenManifests
 UP-TO-DATE
:app:processDebugManifest
/home/arjun/Desktop/phone/goodbackup/platforms/android/app/src/main/AndroidManifest.xml:16:5-74 Error:
    uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [:CordovaLib] /home/arjun/Desktop/phone/goodbackup/platforms/android/CordovaLib/build/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 14
    Suggestion: use a compatible library with a minSdk of at most 14,
        or increase this project's minSdk version to at least 16,
        or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)



See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


:app:processDebugManifest FAILED



FAILURE: 
Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> 
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [:CordovaLib] /home/arjun/Desktop/phone/goodbackup/platforms/android/CordovaLib/build/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 14
    Suggestion: use a compatible library with a minSdk of at most 14,

        or increase this project's minSdk version to at least 16,

        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 1s

23 actionable tasks: 1 executed, 22 up-to-date

Error: /home/arjun/Desktop/phone/goodbackup/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/arjun/Desktop/phone/goodbackup/platforms/android/app/src/main/AndroidManifest.xml:16:5-74 Error:
    uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [:CordovaLib] /home/arjun/Desktop/phone/goodbackup/platforms/android/CordovaLib/build/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 14
    Suggestion: use a compatible library with a minSdk of at most 14,
        or increase this project's minSdk version to at least 16,
        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:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 16 declared in library [:CordovaLib] /home/arjun/Desktop/phone/goodbackup/platforms/android/CordovaLib/build/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 14
    Suggestion: use a compatible library with a minSdk of at most 14,
        or increase this project's minSdk version to at least 16,
        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 1s
android cordova cordova-plugins phonegap phonegap-cli
1个回答
5
投票

这是模板上的一个错误,我很久以前修复了它,但他们没有发布新版本的模板。

在您的config.xml中,您将找到此首选项:

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

只需将其删除或将值设置为16即可。

© www.soinside.com 2019 - 2024. All rights reserved.