Ionic release : Android package can not build - android

We are trying to build an apk package for a new version on android store.
We got the following error :
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.
We have no clue why and tried to debug it with the ionic dashboard unsuccessfuly.
Thank you

Increase your android-minSdkVersion to 19 inside your config.xml of your ionic project.
<preference name="android-minSdkVersion" value="19" />

Related

Can't build apk in react native

I have a task to build apk applications with react native, I watched this video to understand how to do it and took the same code
https://www.youtube.com/watch?v=5tgcogEoIiQ&t=590s
https://github.com/mahdi-sharifimehr/RN-Tutorial-Main/tree/RN-Tutorial-35
I got such an error:
> Task :app:processDebugManifest FAILED
Type 'ProcessApplicationManifest': static method 'getArtifactName()' should not be annotated with: #Internal. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Type 'ProcessApplicationManifest': static method 'getNameFromAutoNamespacedManifest()' should not be annotated with: #Internal. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
/root/escrow_checker/apps/RN-Tutorial-Main-RN-Tutorial-35/android/app/src/debug/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.71.0-rc.0] /root/.gradle/caches/transforms-2/files-2.1/af47c244ab2af63c65c98f6eb4516ef2/jetified-react-native-0.71.0-rc.0-debug/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 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
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 21 declared in library [com.facebook.react:react-native:0.71.0-rc.0] /root/.gradle/caches/transforms-2/files-2.1/af47c244ab2af63c65c98f6eb4516ef2/jetified-react-native-0.71.0-rc.0-debug/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 21,
or use tools:overrideLibrary="com.facebook.react" 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. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19s
found a solution on the Internet and changed minSdkVersion in build.gradle to 23, but now I get such an error:
> Task :app:processDebugResources FAILED
Type 'LinkApplicationAndroidResourcesTask': non-property method 'canHaveSplits()' should not be annotated with: #Input. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/root/.gradle/caches/transforms-2/files-2.1/991cf6dc746cd39d23cce3c15a61bfa7/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
please tell me what's wrong and why I can't easily build the apk, here are my actions
in main directory
npm install
cd android
chmod +x ./gradlew
./gradlew assembleDebug
Gradle version Gradle 7.4.2
I don’t understand why it doesn’t want to build, in theory I should have got apk
" uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library "
Looks like your minSdkVersion isn't compatible with your facebook library you're using. What kind of React Native project are you using?
If it's expo managed you'll need this: https://docs.expo.dev/versions/latest/sdk/build-properties/
If it's a non-expo project, you can easily go into the Android files on your own. This link will help you: How to specify the minSdkVersion in react native project
It's likely that you just need to change the 16 to a 21 and it'll build.

How can I resolve min SDK version error in flutter for android development?

I am developing a bluetooth app using flutter in android studio. I am getting the following error:
The plugin flutter_blue uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib\main.dart on SM G885F in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Apps\Bluetooth\android\app\build.gradle' line: 51
What went wrong:
Could not compile build file 'C:\Apps\Bluetooth\android\app\build.gradle'.
startup failed:
build file 'C:\Apps\Bluetooth\android\app\build.gradle': 51: Statement labels may not be used in build scripts.
In case you tried to configure a property named 'minSdkVersion', replace ':' with '=' or ' ', otherwise it will not have the desired effect.
# line 51, column 24.
minSdkVersion: 19
^
1 error
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
in my case, i solved it by changing the minSDK 19 to 29, just update the number from 19 to 29 and try build your app.

Flutter error: Exception: Gradle task assembleDebug failed with exit code 1

My android emulator run successfully, and before a project clone from github my flutter project worked fine. But when I clone a project after that show me a error, when I run my project, error like this:
Running Gradle task 'assembleDebug'...
Parameter format not correct -
D:\Flutter project\Practice\flutter_app_demo\android\app\src\debug\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [:audioplayers] D:\Flutter project\Practice\flutter_app_demo\build\audioplayers\intermediates\library_manifest\debug\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 23,
or use tools:overrideLibrary="xyz.luan.audioplayers" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [:audioplayers] D:\Flutter project\Practice\flutter_app_demo\build\audioplayers\intermediates\library_manifest\debug\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 23,
or use tools:overrideLibrary="xyz.luan.audioplayers" 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. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 45s
Exception: Gradle task assembleDebug failed with exit code 1
I don't know why show error like this.
Any suggestion Please.
its seems you have an error in your AndroidManifest.xml if you making any change in this file you should check it or put this file here to taking look at it

IONIC apk Generate Issue

I have getting this error when I run ionic cordova build --release android
but yesterday it was running perfectly im not change anything about configuration only build distribution I think it is version issue but I unable to find how to resolve it please help
here is console log
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:releaseCompileClasspath'.
> Could not find any version that matches com.google.firebase:firebase-measurement-connector:[10.2.1,12.1.0[.
Versions that do not match:
17.0.0
16.0.0
15.0.0
Required by:
project :app > com.google.firebase:firebase-messaging:17.0.0
* 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 41s
11 actionable tasks: 11 executed
(node:15826) UnhandledPromiseRejectionWarning: Error: /home/chamikara/Projects/freelance/ionic/beachlines/notifications/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:releaseCompileClasspath'.
> Could not find any version that matches com.google.firebase:firebase-measurement-connector:[10.2.1,12.1.0[.
Versions that do not match:
17.0.0
16.0.0
15.0.0
Required by:
project :app > com.google.firebase:firebase-messaging:17.0.0
* 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 41s
at ChildProcess.whenDone (/home/chamikara/Projects/freelance/ionic/beachlines/notifications/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:15826) 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:15826) [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.
Related to this answer : https://stackoverflow.com/a/51779975/279326 I fixed by going back to ionic#4.0.3 npm i -g ionic#4.0.3

Ionic 3 - Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

I am having trouble in building my ionic 3 app. Every time I try to build the android app it gives the following error.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
37 actionable tasks: 10 executed, 27 up-to-date
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 35s
(node:5924) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: 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.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
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 35s
Picked up _JAVA_OPTIONS: -Xmx512M
(node:5924) [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.
Can anyone help me with the issue?
cordova clean android should fix your problem.
I solved it by removing platform and adding it again:
ionic cordova platform rm android
ionic cordova platform rm ios
ionic cordova platform add android
ionic cordova platform add ios
If the cordova clean command does not solve this problem for you, it might be related to the new implementation of AndroidX in some of your libraries.
In my case it was cordova-plugin-firebase-analytics
Follow these steps:
0 / Remove your android platform
cordova platform rm android
1 / Remove all plugins related to support / gradle / firebase versions control (Optional -- I didn't need to remove any plugins. So if you are not sure about how to do this, just skip this step)
2 / Add the AndroidX plugins from #dpa99c :
# add plugin to enable AndroidX in the project
cordova plugin add cordova-plugin-androidx
# add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX
cordova plugin add cordova-plugin-androidx-adapter
3 / Add your android platform
cordova platform add android
Thanks to #MathieuNa : https://forum.ionicframework.com/t/d8-program-type-already-present/166812/4?u=carlosglegaspi
Delete this folder: "../app/build"

Categories

Resources