Build faild in android uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library


#1

i’m getting this error while i trying to build android

BUILD FAILED
 in 1s

(node:1880) UnhandledPromiseRejectionWarning: Error: /Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/build.gradle' line: 55

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'build' for root project 'android' of type org.gradle.api.Project.

* 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
    at ChildProcess.whenDone (/Users/anspireagency/Desktop/ahmed f/Doctory/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:1880) 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:1880) [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.```

#2

Hi, What is your command ?


#3

ionic cordova build android
now i getting this error

:app:processDebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 4s
23 actionable tasks: 3 executed, 20 up-to-date
(node:3131) UnhandledPromiseRejectionWarning: Error: /Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/app/src/main/AndroidManifest.xml:27:5-74 Error:
        uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 4s
    at ChildProcess.whenDone (/Users/anspireagency/Desktop/ahmed f/Doctory/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:3131) 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:3131) [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.

#4

Have you already install Android Studio and Gradle android ? If not you need to do this and retry after that


#5

i already installed them
now this error from android studio


#6

Maybe you need to download SDK version 16 into SDK Manager of Android Studio ?


#7

i have updated the sdk and still getting error

 UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
/Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/app/src/main/AndroidManifest.xml:27:5-74 Error:
        uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 17s


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

:app:processDebugManifest FAILED
23 actionable tasks: 1 executed, 22 up-to-date
(node:4302) UnhandledPromiseRejectionWarning: Error: /Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/app/src/main/AndroidManifest.xml:27:5-74 Error:
        uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 16 cannot be smaller than version 19 declared in library [:tbxml-android:] /Users/anspireagency/.gradle/caches/transforms-1/files-1.1/tbxml-android.aar/3ed1ecc6627bfe7aa681fa1d0e6cfd6b/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="za.co.twyst" 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 17s
    at ChildProcess.whenDone (/Users/anspireagency/Desktop/ahmed f/Doctory/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:4302) 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:4302) [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.

#8

Define <preference name="android-minSdkVersion" value="19" /> in config.xml file.


#9

This is caused when you install google maps plugin. This is how I solved it:

  • run “ionic cordova platform rm android” to remove the android platform
  • edit android-minSdkVersion to reflect 19 in your config.xml
  • add android platform and it should work.

#10

I uninstall ionic cordova plugin remove cordova-plugin-googlemaps and work version 16 (ionic cordova build android --prod)


#11

Hey.
for the one of you who still struggle with this, i found out that the line
in config.xml file does not influence.
the solution i found is adding this: “-- – --minSdkVersion=21” to the build command like this:
ionic cordova build android --prod --release – -- --minSdkVersion=19

Hope it helps


#12

thank you for reply
i will try it soon


#13

it work for me… thanks


#14

If I change it, dont generate the “outputs” folder and the unsigned-apk when i build :S


#15

This works for me. Thank a lot.


#16

Worked fine for me, thanks!


#17

not work for me.
still shows the error
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] /FOLDER_PROJECT/build\intermediates\manifests\full\debug\AndroidManifest.xml as the library might be using APIs not available in 16


#18

Please post here the full build command, maybe there is some mistake.

Yosi


#19

Number of hyphenes are not correct, there supposed to be 6 hyphenes before minSdkversion=21 command.

Try it out… it works…