react native apk build fail when using react-native-razorpay - react-native

I'm trying to build an signed apk for my react-native code. I've used react-native-razorpay library for payment integration purpose.
On running cd android && ./gradlew assembleRelease in my project root directory I got stuck on following error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-razorpay:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* 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 22s
102 actionable tasks: 2 executed, 100 up-to-date
While running ./gradlew assembleRelease --info i get following in the last few lines-
....
....
Successfully started process 'command '/Users/clove/Library/Android/sdk/build-tools/27.0.3/aapt''
/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v24/values-v24.xml:3:5-157: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v24/values-v24.xml:4:5-135: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v26/values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
> Task :react-native-razorpay:verifyReleaseResources FAILED
Putting task artifact state for task ':react-native-razorpay:verifyReleaseResources' into context took 0.0 secs.
Up-to-date check for task ':react-native-razorpay:verifyReleaseResources' took 0.0 secs. It is not up-to-date because:
Task has failed previously.
All input files are considered out-of-date for incremental task ':react-native-razorpay:verifyReleaseResources'.
Unable do incremental execution: full task run
QueuedCruncher is using /Users/clove/Library/Android/sdk/build-tools/27.0.3/aapt
Shutdown finished in 0ms
:react-native-razorpay:verifyReleaseResources (Thread[Daemon worker Thread 18,5,main]) completed. Took 0.402 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-razorpay:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --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 1m 16s
102 actionable tasks: 9 executed, 93 up-to-date

Found a solution. Turned out that the problem was due to configuration mismatch. the gradle version I was using was above 3, which requires the android sdk version 25 or above. Whereas react-native-razorpay was shipped with sdk version 23. So I changed those settings in node_modules and the build completed successfully.

Related

when used sharedpreferences packge in yaml found error

Launching lib\main.dart on Redmi Note 7 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\DELL\Downloads\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\Users\DELL\Downloads\flutter\bin\flutter.bat'' finished with non-zero exit value 1
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 4s
Exception: Gradle task assembleDebug failed with exit code 1
what is the solution

android build failure for react native source code

I am building official react native cloned fro git hub and check out to version v0.69.6. But failed to build.
The official document doesn't help much, I don't know what is wrong.
1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':ReactAndroid:prepareJSC' (type 'PrepareJSCTask').
- In plugin 'com.facebook.react' type 'com.facebook.react.tasks.internal.PrepareJSCTask' property 'jscPackagePath' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
1. Assign a value to 'jscPackagePath'.
2. Mark property 'jscPackagePath' as optional.
Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#value_not_set for more details about this problem.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':packages:rn-tester:android:app:buildCodegenCLI'.
> Process 'command '/home/ANT.AMAZON.COM/chngang/opensource/react-native-dev/node_modules/react-native/node_modules/react-native-codegen/scripts/oss/build.sh'' finished with non-zero exit value 254
* 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 8s
19 actionable tasks: 7 executed, 12 up-to-date
Someone met the same issue with any solution

Exception when building a kotlin/js project: error package.json: Name contains illegal characters

Trying to build the a kotlin/js project and getting the following exception:
error package.json: Name contains illegal characters
The project is here:
https://github.com/darran-kelinske-fivestars/cordova-alternative-pattern/tree/kotlin_multiplatform/js
Full output:
3:05:37 PM: Executing task 'build'...
Executing tasks: [build] in project /rom/source/fivestars/CordovaAlternativePattern/js
> Configure project :SharedCode
Kotlin Multiplatform Projects are an experimental feature.
> Task :SharedCode:jsPackageJson
> Task :js:packageJson
> Task :js:testPackageJson
> Task :kotlinNodeJsSetup SKIPPED
> Task :kotlinNpmInstall FAILED
error package.json: Name contains illegal characters
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
yarn install v1.21.1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
* 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 885ms
4 actionable tasks: 4 executed
3:05:38 PM: Task execution finished 'build'.
The issue was with my rootProject.name definition in settings.gradle
I had to change
rootProject.name='Cordova Alternative Pattern'
to
rootProject.name='CordovaAlternativePattern'

I got below error while generating release build in react native android .file already exist

D:\ReactNative Workspace\awesome\android>gradlew clean
BUILD SUCCESSFUL in 4s
2 actionable tasks: 2 executed
D:\ReactNative Workspace\awesome\android>gradlew assembleRelease
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
info Writing bundle output to:, D:\ReactNative
info Writing sourcemap output to:, D:\ReactNative
info Done writing bundle output
info Done writing sourcemap output
info Copying 1 asset files
error EEXIST: file already exists, mkdir 'D:\ReactNative'. Run CLI with --verbos
e flag for more details.
Error: EEXIST: file already exists, mkdir 'D:\ReactNative'
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'npx.cmd'' finished with non-zero exit value 1
* 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 1m 14s
7 actionable tasks: 7 executed
D:\ReactNative Workspace\awesome\android>
I was facing the same issue, It's actually not an error you just need to check the path of your "Key Store Path" If there is any space between your path the build fails, Try changing the path which is free from spaces, then build the project you should not see any errors now.

Error: The resource `Path-to-project-root-directory\index.ts` was not found

I am working on a react-native project and wanted to generate the signed apk for deployment on Play store. I am following the
official documentation for this:
https://facebook.github.io/react-native/docs/signed-apk-android
Building unsigned apk, works just fine.
But for signed apk, after generating "my-upload-key.keystore" and placing it in /android/app directory (inlcluding other settings as guided in docs.), whenever I run command
"gradlew bundleRelease", it gives the following error:
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
error The resource Path-to-project-root-directory\index.ts was not found.. Run CLI with --verbose flag for more details.
Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Process 'command 'cmd'' finished with non-zero exit value 1
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 1m 39s
4 actionable tasks: 1 executed, 3 up-to-date