科尔多瓦建立minsdkversion错误

arj*_*jun 2 android cordova cordova-plugins phonegap-cli phonegap

尝试构建没有其他插件的空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)
Run Code Online (Sandbox Code Playgroud)

我尝试将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"
Run Code Online (Sandbox Code Playgroud)

日志输出

>$ 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
Run Code Online (Sandbox Code Playgroud)

jce*_*ile 5

那是模板上的错误,我很久以前就解决了,但是他们没有发布模板的新版本。

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

<preference name="android-minSdkVersion"      value="14" />
Run Code Online (Sandbox Code Playgroud)

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

  • 转到“平台&gt; android&gt; CordovaLib&gt; AndroidManifest.xml”并编辑“ minSdkVersion”即可处理该错误。 (2认同)
  • 是的,但是不建议您在此进行手动更改,我提到的偏好设置无需手动修改即可设置该值 (2认同)