I am getting a strange error when trying to build an empty phonegap project which has no additional plugins
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)
I tried editing the config.xml and the android manifest xml to version 16, but it is still throwing the same Build Failed
error
Using Phonegap 7.1.1. I had no issues building apps earlier, it is throwing this error unexpectedly now.
Plugin list
>$ 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"
Log output
>$ 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
That's a bug on the templates, I fixed it long time ago, but they didn't release a new version of the templates.
In your config.xml you'll find this preference:
<preference name="android-minSdkVersion" value="14" />
Just remove it or set the value to 16.