./gradle bundlerelease not generating aab - react-native

I was trying to build an app via ./gradle bundlerelease
got an error everytime:
C:\Users\xxx\Desktop\app\node_modules\#react-native-firebase\app\android\src\reactnative\java\io\invertase\firebase\app\ReactNativeFirebaseAppInitProvider.java:25: error: cannot find symbol
BuildConfig.APPLICATION_ID + ".reactnativefirebaseappinitprovider";
^
symbol: variable APPLICATION_ID
location: class BuildConfig
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-firebase_app:compileReleaseJavaWithJavac'.
Compilation failed; see the compiler error output for details.

Downgrad the gradle to 3.6.0 (in build.gradle) and rebuild the project.
classpath('com.android.tools.build:gradle:3.6.0')

Related

How to fix gradlew exception

I am new to java and trying to run gradlew for the first time.
I am seeing below error.
Please advise how to fix it.
% ../gradlew
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/kalpesh/work/iraga/message-api/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/kalpesh/work/iraga/message-api/settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61

cannot build with react-native-msal, Deprecated Gradle features were used in this build

I'm really new to mobile development and I'm trying to implement authentication in a simple react-native app using react-native-msal.
I'm using React Native CLI (ie npx react-native run-android) and after initializing a new app and confirming all is working my my virtual device, I added react-native-msal and followed the directions to set things up for android.
But after running the areact-native-msal, the build fails with "Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0."
I've tried changing versions in the gradle-wrapper.properties file but I don't get any further.
PS C:\Working\MSALDemo> npx react-native run-android
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 941 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
> Task :react-native-msal:compileDebugJavaWithJavac
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
48 actionable tasks: 42 executed, 6 up-to-date
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Note: C:\Working\MSALDemo\node_modules\react-native-msal\android\src\main\java\com\reactnativemsal\RNMSALModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Working\MSALDemo\node_modules\react-native-msal\android\src\main\java\com\reactnativemsal\RNMSALModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\newarchitecture\MainApplicationReactNativeHost.java:22: error: cannot find symbol
import com.msaldemo.BuildConfig;
^
symbol: class BuildConfig
location: package com.msaldemo
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainActivity.java:36: error: cannot find symbol
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
^
symbol: variable BuildConfig
location: class MainActivityDelegate
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:22: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:45: error: cannot find symbol
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:45: error: illegal parenthesized expression
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
^
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:56: error: cannot find symbol
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:70: error: cannot find symbol
if (BuildConfig.DEBUG) {
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:70: error: illegal parenthesized expression
if (BuildConfig.DEBUG) {
^
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\newarchitecture\MainApplicationReactNativeHost.java:42: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
location: class MainApplicationReactNativeHost
Note: C:\Working\MSALDemo\android\app\src\debug\java\com\msaldemo\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
9 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 17s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Note: C:\Working\MSALDemo\node_modules\react-native-msal\android\src\main\java\com\reactnativemsal\RNMSALModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Working\MSALDemo\node_modules\react-native-msal\android\src\main\java\com\reactnativemsal\RNMSALModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\newarchitecture\MainApplicationReactNativeHost.java:22: error: cannot find symbol
import com.msaldemo.BuildConfig;
^
symbol: class BuildConfig
location: package com.msaldemo
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainActivity.java:36: error: cannot find symbol
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
^
symbol: variable BuildConfig
location: class MainActivityDelegate
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:22: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:45: error: cannot find symbol
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:45: error: illegal parenthesized expression
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
^
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:56: error: cannot find symbol
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:70: error: cannot find symbol
if (BuildConfig.DEBUG) {
^
symbol: variable BuildConfig
location: class MainApplication
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\MainApplication.java:70: error: illegal parenthesized expression
if (BuildConfig.DEBUG) {
^
C:\Working\MSALDemo\android\app\src\main\java\com\msaldemo\newarchitecture\MainApplicationReactNativeHost.java:42: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
location: class MainApplicationReactNativeHost
Note: C:\Working\MSALDemo\android\app\src\debug\java\com\msaldemo\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
9 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 17s
at makeError (C:\Working\MSALDemo\node_modules\execa\index.js:174:9)
at C:\Working\MSALDemo\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Working\MSALDemo\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Working\MSALDemo\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
PS C:\Working\MSALDemo>
Figured out the missing piece, courtesy of this LinkedIn article.
I needed to
declare a dependency on MSAL in the app's build.gradle file:
implementation "com.microsoft.identity.client:msal:1.0+"
Add the following maven repository to your project's build.gradle:
allProjects {
repositories {
// ...
maven {
url "https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1"
}
}
}

react-native Cannot find cannot find symbol Freshchat after upgrading react-native-freshchat-sdk

I upgraded freshchat from "react-native-freshchat-sdk": "^2.6.4" to "react-native-freshchat-sdk": "^4.0.3" and tried running the android app but the build failed with error
Compatible side by side NDK version was not found for android.ndkVersion '22.1.7171670'
> Task :app:compileDebugJavaWithJavac
> Task :app:compileDebugJavaWithJavac FAILED
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.2/userguide/command_line_interface.html#sec:command_line_warnings
500 actionable tasks: 6 executed, 494 up-to-date
/Users/angellanaigaga/Desktop/numida/trackapp/frontend/trackapp-native/android/app/src/main/java/com/numidatech/numida/NumidaMessagingService.java:3: error: cannot find symbol
import com.freshchat.consumer.sdk.Freshchat;
^
symbol: class Freshchat
location: package com.freshchat.consumer.sdk
/Users/angellanaigaga/Desktop/numida/trackapp/frontend/trackapp-native/android/app/src/main/java/com/numidatech/numida/NumidaMessagingService.java:11: error: cannot find symbol
if (Freshchat.isFreshchatNotification(message)) {
^
symbol: variable Freshchat
location: class NumidaMessagingService
/Users/angellanaigaga/Desktop/numida/trackapp/frontend/trackapp-native/android/app/src/main/java/com/numidatech/numida/NumidaMessagingService.java:12: error: cannot find symbol
Freshchat.handleFcmMessage(this.getApplicationContext(), message);
^
symbol: variable Freshchat
location: class NumidaMessagingService
Note: /Users/angellanaigaga/Desktop/numida/trackapp/frontend/trackapp-native/android/app/src/debug/java/com/numidatech/numida/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 30s
After digging into the Freshworks and
roid Github, I had to update my App Module gradle file (app/build.gradle) to include freshdesk:freshchat in dependencies like this
dependencies {
implementation 'com.github.freshdesk:freshchat-android:{latestVersion}'
}
...
implementation (project(':react-native-freshchat-sdk')){
exclude group: 'com.github.freshworks'
}
implementation 'com.github.freshdesk:freshchat-android:5.3.3'

Why when I want to run an Android yarn error like this?

Why when I want to run an Android yarn error like this?
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :app:processDebugResources FAILED
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.0.1/userguide/command_line_interface.html#sec:command_line_warnings
10 actionable tasks: 2 executed, 8 up-to-date
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
D:\xampp\htdocs\konspirasiSnack\android\app\src\main\AndroidManifest.xml:6:5-25:19: AAPT: error: resource m
ipmap/ic_launcher (aka com.konspirasisnack:mipmap/ic_launcher) not found.
D:\xampp\htdocs\konspirasiSnack\android\app\src\main\AndroidManifest.xml:6:5-25:19: AAPT: error: resource s
tring/app_name (aka com.konspirasisnack:string/app_name) not found.
D:\xampp\htdocs\konspirasiSnack\android\app\src\main\AndroidManifest.xml:6:5-25:19: AAPT: error: resource m
ipmap/ic_launcher_round (aka com.konspirasisnack:mipmap/ic_launcher_round) not found.
D:\xampp\htdocs\konspirasiSnack\android\app\src\main\AndroidManifest.xml:6:5-25:19: AAPT: error: resource s
tyle/AppTheme (aka com.konspirasisnack:style/AppTheme) not found.
D:\xampp\htdocs\konspirasiSnack\android\app\src\main\AndroidManifest.xml:13:7-23:18: AAPT: error: resource
string/app_name (aka com.konspirasisnack:string/app_name) not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. R
un with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 35s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnat
ive.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
react native versi 0.62.2
distributionUrl=https://services.gradle.org/distributions/gradle-6.0.1-all.zip
os windows 10
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
ANDROID_HOME = C:\Users\user\AppData\Local\Android\Sdk
JAVA_HOME = C:\Program Files\Java\jdk

`react-native run-android` fails when I pass `--deviceId`

I have a react-native project that builds fine with react-native run-android. But if I run it as react-native run-android --deviceId xxxx, I get the following error:
> Task :#remobile_react-native-qrcode-local-image:verifyReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':#remobile_react-native-qrcode-local-image:verifyReleaseResources'.
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:7: error: resource android:attr/colorError not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:11: error: resource android:attr/colorError not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2734: error: resource android:attr/fontStyle not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2735: error: resource android:attr/font not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2736: error: resource android:attr/fontWeight not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2737: error: resource android:attr/fontVariationSettings not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2738: error: resource android:attr/ttcIndex not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2902: error: resource android:attr/startX not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2905: error: resource android:attr/startY not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2908: error: resource android:attr/endX not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2911: error: resource android:attr/endY not found.
/home/justin/BlueWallet/node_modules/#remobile/react-native-qrcode-local-image/android/build/intermediates/res/merged/release/values/values.xml:2919: error: resource android:attr/offset not found.
error: failed linking references.
It's quite strange. It's as if react-native can't interpret static files in a QR-code library when passing a --deviceId. Any ideas why this might be?
Here's the repo if anyone is interested.