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.
Related
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.
I'm trying to build my Apache Cordova app for android and I face with this error. I found that android:exported="true" must be added to the activity attributes but since I am using many cordova-plugins which add different activity attribute to the AndroidManifest.xml it is impossible to change all of them manually.
I want to know does anyone have any solution for this problem?
Note: For using new plugins I cannot downgrade my sdk target version to 30 an I must use 31.
Error code:
[17:39:47] FAILURE: Build failed with an exception.
[17:39:47] * What went wrong:
[17:39:47] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[17:39:47] Execution failed for task ':app:processReleaseMainManifest'.
[17:39:47] > Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
[17:39:47] * Try:
[17:39:47] 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.
[17:39:47] * Get more help at https://help.gradle.org
[17:39:47] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[17:39:47] See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
[17:39:47] 14 actionable tasks: 14 executed
[17:39:47] BUILD FAILED in 1m 34s
[17:39:47] Command failed with exit code 1: /tmp/download/platforms/android/gradlew :app:bundleRelease -b /tmp/download/platforms/android/build.gradle
I upgraded to the latest Flutter version.
Afterwards it started giving the error...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:
/myAppPath/android/app/src/main/AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Build failed due to use of deprecated Android v1 embedding.
I then went to the migration guide and implemented the required changes which were changing the first line to the second
-android:name="io.flutter.app.FlutterApplication"
+android:name="#{applicationName}"
Now I get the error...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/pathToMyApp/android/app/src/main/AndroidManifest.xml:8:5-51:19: AAPT: error: attribute 'android:name' in <application> tag must be a valid Java class name.
* 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 41s
Running Gradle task 'assembleRelease'... 41.9s
Gradle task assembleRelease failed with exit code 1
Do this
android:name="${applicationName}"
instead of
android:name="#{applicationName}"
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{}],"original":"ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).\nerror: failed to create archive.\n\n ","tool":"AAPT"}
Task :app:mergeDebugNativeLibs
Task :app:mergeExtDexDebug
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.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).
error: failed to create archive.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
27 actionable tasks: 26 executed, 1 up-to-date
Can anyone help me to solve this problem...? please...
This is what happens when aapt fails to create an archive.
First make sure you are using the latest IDE and SDK. aapt for packaging is obsolete, and the earlier aapt2 has many bugs.
If they are up to date, try to check if the following processes on your computer have read/write access to the project directory.
[your android sdk path]\build-tools[your sdk version]\aapt.exe
[your android sdk path]\build-tools[your sdk version]\aapt2.exe
[your android studio path]\bin\studio64.exe
[your android studio path]\bin\fsnotifier64.exe
[your android studio path]\jre\bin\java.exe
[your android studio path]\jre\bin\javaw.exe
If you haven't set permissions manually, they are usually blocked by security software.
I recently ran into this problem and spent a lot of time finally found out that the security software on my workstation was not adding aapt2 and aapt to the allowed list for the project repository.
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