Task 'installDebug' not found in project ':app', and Build Failed - react-native

This is an error I'm facing
Package.json
"dependencies": {
"#react-native-async-storage/async-storage": "^1.16.0",
"#react-native-community/clipboard": "^1.5.1",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/netinfo": "^7.1.5",
"#react-native-firebase/app": "^14.12.0",
"#react-native-firebase/messaging": "^14.2.2",
"#react-navigation/drawer": "^6.1.8",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.0.11",
"android": "^0.0.8",
"axios": "^0.24.0",
"linkify-html": "^3.0.5",
"moment": "^2.29.1",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-barcode-builder": "^2.0.0",
"react-native-camera": "^4.2.1",
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.11",
"react-native-dots-pagination": "^0.2.0",
"react-native-flash-message": "^0.2.0",
"react-native-floating-action": "^1.22.0",
"react-native-geolocation-service": "^5.3.0-beta.4",
"react-native-gesture-handler": "^2.0.0",
"react-native-gradient-buttons": "^2.0.2",
"react-native-html-to-pdf": "^0.12.0",
"react-native-hyperlink": "^0.0.19",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-linear-gradient": "^2.5.6",
"react-native-marquee": "^0.3.2",
"react-native-material-menu": "^2.0.0",
"react-native-modal": "^13.0.1",
"react-native-open-maps": "^0.4.0",
"react-native-pager-view": "^5.4.9",
"react-native-permissions": "^3.2.0",
"react-native-phone-number-input": "^2.1.0",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-qrcode-svg": "^6.1.2",
"react-native-reanimated": "^2.2.4",
"react-native-render-html": "^6.3.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.0",
"react-native-share": "^7.3.5",
"react-native-splash-screen": "^3.3.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "^12.1.1",
"react-native-unimodules": "^0.14.10",
"react-native-uuid": "^2.0.1",
"react-native-viewpager": "^0.2.13",
"react-native-wallet": "^1.0.8",
"react-native-webview": "^11.15.0",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
android/build.gradle
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + "0.66.5"
}
}
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://www.jitpack.io' }
maven { url "https://maven.google.com" }
}
}
android/app/build.gradle
dependencies {
implementation project(':react-native-html-to-pdf')
implementation project(':react-native-share')
implementation project(':react-native-sqlite-storage')
implementation 'com.android.support:multidex:2.0.1'
implementation project(':react-native-art')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
implementation project(':react-native-pager-view')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
apply from: file("../../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
What I have tried...
I think the commands which is necessary to solve the error I almost tried to solve...
And also I have set the environment setup very properly as the react native setup docs says ...
I have updated gradle version , kotlin version, react native version , npm version , node version etc...
I have also updated Firebase app , Firebase message and Firebase.. where Firebase app and messages version should be same...
I have also set up the SDK TOOLS, Android SDK in Android studio ...
I have uninstalled the nodes, vs code and again reinstalled it but again facing the same issue i.e. Build Failed....

There are multiple options you can try.
There are chances that your application is not getting enough space to get installed on emulator.
Create new emulator in that under Verify Configuration click on Show Advance Settings and modify Memory and Storage block as shown below and now try running your application in newly created emulator.
Open your project into android studio and try running application from android studio and not using command line
Let me know doest it helpful to you or not.

Related

Build Failed In React Native , And Execution failed for task ':react-native-screens:compileDebugKotlin'

ERROR..BUILD FAILED
This is my Package.json
{
"name": "eMembershipCard",
"version": "0.0.4",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"android_emembershipcard": "react-native run-android --variant=emembershipcardDebug --appIdSuffix = 'membershipdemo' ",
"android_omaha": "react-native run-android --variant=omahaDebug --appIdSuffix = 'ocm' ",
"android_magichouse": "react-native run-android --variant=magichouseDebug --appIdSuffix = 'magichouse' ",
"ios_emembershipcard": "react-native run-ios --scheme eMembershipCard --configuration eMembershipCard",
"ios_omaha": "react-native run-ios --scheme omaha --configuration omaha",
"ios_magichouse": "react-native run-ios --scheme magichouse --configuration magichouse",
"emembership-build": "cd android && ./gradlew assembleemembershipcardRelease",
"emembership-build-debug": "cd android && ./gradlew assembleemembershipcardDebug",
"omaha-build-debug": "cd android && ./gradlew assembleomahaDebug",
"magichouse-build-debug": "cd android && ./gradlew assemblemagichouseDebug",
"emembership-build-debug-bundle": "cd android && ./gradlew bundleemembershipcardDebug",
"omaha-build-debug-bundle": "cd android && ./gradlew bundleomahaDebug",
"magichouse-build-debug-bundle": "cd android && ./gradlew bundlemagichouseDebug"
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.16.0",
"#react-native-community/clipboard": "^1.5.1",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/netinfo": "^7.1.5",
"#react-native-firebase/app": "^14.12.0",
"#react-native-firebase/messaging": "^14.2.2",
"#react-navigation/drawer": "^6.1.8",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.0.11",
"android": "^0.0.8",
"axios": "^0.24.0",
"linkify-html": "^3.0.5",
"moment": "^2.29.1",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-barcode-builder": "^2.0.0",
"react-native-camera": "^4.2.1",
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.11",
"react-native-dots-pagination": "^0.2.0",
"react-native-flash-message": "^0.2.0",
"react-native-floating-action": "^1.22.0",
"react-native-geolocation-service": "^5.3.0-beta.4",
"react-native-gesture-handler": "^2.0.0",
"react-native-gradient-buttons": "^2.0.2",
"react-native-html-to-pdf": "^0.12.0",
"react-native-hyperlink": "^0.0.19",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-linear-gradient": "^2.5.6",
"react-native-marquee": "^0.3.2",
"react-native-material-menu": "^2.0.0",
"react-native-modal": "^13.0.1",
"react-native-open-maps": "^0.4.0",
"react-native-pager-view": "^5.4.9",
"react-native-permissions": "^3.2.0",
"react-native-phone-number-input": "^2.1.0",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-qrcode-svg": "^6.1.2",
"react-native-reanimated": "^2.2.4",
"react-native-render-html": "^6.3.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.0",
"react-native-share": "^7.3.5",
"react-native-splash-screen": "^3.3.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "^12.1.1",
"react-native-unimodules": "^0.14.10",
"react-native-uuid": "^2.0.1",
"react-native-viewpager": "^0.2.13",
"react-native-wallet": "^1.0.8",
"react-native-webview": "^11.15.0",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
What I have tried...
I think the commands which is necessary to solve the error I almost tried to solve...
And also I have set the environment setup very properly as the react native setup docs says ...
I have updated gradle version , kotlin version, react native version , npm version , node version etc...
I have also updated Firebase app , Firebase message and Firebase.. where Firebase app and messages version should be same...
I have also set up the SDK TOOLS, Android SDK in Android studio ...
I have uninstalled the nodes, vs code and again reinstalled it but again facing the same issue i.e. Build Failed....
Here is my android/build.gradle
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
kotlin_version = '1.7.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://www.jitpack.io' }
}
}
In app/build.gradle already passes key under signing configs...
signingConfigs {
debug {
storeFile file('AppsDNA_production.keystore')
storePassword 'inficare#123'
keyAlias 'appsdna'
keyPassword 'inficare#123'
}
release {
storeFile file('AppsDNA_production.keystore')
storePassword 'inficare#123'
keyAlias 'appsdna'
keyPassword 'inficare#123'
}
}
PS D:\ememberProject\eMembership-React-Native> npm version
{
eMembershipCard: '0.0.4',
npm: '9.1.3',
node: '19.1.0',
v8: '10.7.193.20-node.19',
uv: '1.44.2',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.18.1',
modules: '111',
nghttp2: '1.47.0',
napi: '8',
llhttp: '8.1.0',
openssl: '3.0.7+quic',
cldr: '42.0',
icu: '72.1',
tz: '2022e',
unicode: '15.0',
ngtcp2: '0.8.1',
nghttp3: '0.7.0'
}
try this package version
"react-native-screens": "3.7.2",

Error : The Android Gradle plugin supports only kotlin-android-extensions Gradle plugin version 1.6.20 and higher. React Native

I tried cloning and building this project,
build.gradle:
Error :
The Android Gradle plugin supports only kotlin-android-extensions Gradle plugin version 1.6.20 and higher.
The following dependencies do not satisfy the required version:
project ':expo' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.20'
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlin_version = "1.7.20"
}
repositories {
google()
mavenCentral()
//gradlePluginPortal()
//jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../android"))
}
maven {
// Android JSC is installed from npm
url(new File(["node", "--print", "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), "../dist"))
}
google()
mavenCentral()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
"dependencies": {
"#config-plugins/react-native-ble-plx": "^3.0.0",
"#daniel-faber/json-ts": "^0.6.0",
"#react-native-async-storage/async-storage": "~1.17.3",
"#react-native-community/netinfo": "9.3.0",
"#react-native-masked-view/masked-view": "0.2.7",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/drawer": "^6.1.8",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.2.1",
"apollo-client": "^2.6.10",
"axios": "^1.1.3",
"expo": "^46.0.0",
"expo-app-loading": "~2.1.0",
"expo-application": "~4.2.2",
"expo-barcode-scanner": "~11.4.0",
"expo-constants": "~13.2.4",
"expo-dev-client": "~1.3.1",
"expo-font": "~10.2.0",
"expo-image-picker": "~13.3.1",
"expo-localization": "~13.1.0",
"expo-network": "~4.3.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"i18next": "^22.0.4",
"js-joda": "^1.11.0",
"lodash": "^4.17.21",
"mipher": "^1.1.5",
"moment": "^2.29.3",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-editable-label": "^1.3.2",
"react-floating-button": "^1.1.1",
"react-i18next": "^12.0.0",
"react-native": "^0.69.5",
"react-native-ble-plx": "^2.0.3",
"react-native-camera": "^4.2.1",
"react-native-circular-action-menu": "^0.5.0",
"react-native-confirm-dialog": "^0.1.0",
"react-native-dash": "^0.0.11",
"react-native-dialog-input": "^1.0.8",
"react-native-flatlist-slider": "^1.0.6",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "~2.5.0",
"react-native-loading-spinner-overlay": "^3.0.1",
"react-native-nfc-manager": "^3.11.5",
"react-native-paper": "^5.0.0-rc.3",
"react-native-paper-dropdown": "^1.0.7",
"react-native-popup-menu": "^0.16.1",
"react-native-qrcode-scanner": "^1.6.0",
"react-native-reanimated": "^2.2.2",
"react-native-root-toast": "^3.3.0",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-simple-dialogs": "^1.5.0",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^9.2.0",
"react-native-web": "~0.18.7",
"react-redux": "8.0.5",
"reactotron-react-native": "^5.0.3",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"rxjs": "^7.5.5",
"use-debounce": "8.0.4"
},
I tried to download ext.kotlin_version = '1.7.20' but it never worked

React Native app crashing on Proguard Enable

I have a React-Native app which is working perfectly fine on debug. But the app doesn't open on release build.
Disabling proguard fixes the issue. So I started looking installation documentation for each third party package installed and my proguard rules seemed fine. Sadly I couldn't detect which package is creating the issue.
My question is : how can I detect which third party package is causing this issue ?
Dependencies :
{
"dependencies": {
"#gorhom/bottom-sheet": "^4.1.5",
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-navigation/bottom-tabs": "^6.0.9",
"#react-navigation/material-top-tabs": "^6.0.6",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.0.11",
"ky": "^0.28.7",
"react": "^17.0.2",
"react-native": "0.66.4",
"react-native-android-location-enabler": "^1.2.2",
"react-native-auto-height-image": "^3.2.4",
"react-native-geolocation-service": "^5.3.0-beta.1",
"react-native-gesture-handler": "^2.1.0",
"react-native-image-crop-picker": "^0.36.0",
"react-native-immersive-mode": "^2.0.0",
"react-native-maps": "^0.29.4",
"react-native-mmkv": "^1.5.4",
"react-native-pager-view": "^5.4.9",
"react-native-paper": "^4.11.1",
"react-native-reanimated": "2.3.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.0.0",
"react-native-version-check": "^3.4.2",
"react-query": "^3.34.5"
},
}
Proguard Rules
-keep class com.facebook.hermes.unicode.** { *; }
-keep class com.facebook.jni.** { *; }
-keep class com.facebook.react.turbomodule.** { *; }
You can test the release build and find errors in the console.
https://reactnative.dev/docs/signed-apk-android#testing-the-release-build-of-your-app

this permision (android.permission.QUERY_ALL_PACKAGES) was automatically added to Manifest

I have a react native app that it worked well until upgrade packages Actually after upgrade packages this permision added (android.permission.QUERY_ALL_PACKAGES) to manifest.please help me
this is first package.json
{
"name": "mazeapp",
"version": "2.0.0",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#gregfrench/react-native-wheel-picker": "^1.2.15",
"#miblanchard/react-native-slider": "^2.0.1",
"#react-native-community/async-storage": "1.12.1",
"#react-native-community/checkbox": "0.3.0",
"#react-native-community/netinfo": "4.6.0",
"#react-native-community/toolbar-android": "0.1.0-rc.2",
"#react-native-firebase/app": "6.7.1",
"#react-native-firebase/messaging": "6.7.1",
"#react-native-picker/picker": "^1.9.10",
"axios": "^0.19.0",
"lottie-react-native": "3.5.0",
"moment-jalaali": "^0.9.2",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native": "0.61.5",
"react-native-app-intro-slider": "4.0.4",
"react-native-awesome-alerts": "1.4.2",
"react-native-background-actions": "^2.6.4",
"react-native-background-timer": "2.4.1",
"react-native-check-box": "^2.1.7",
"react-native-confirmation-code-field": "^4.1.0",
"react-native-date-picker": "3.2.5",
"react-native-device-info": "5.6.5",
"react-native-easy-toast": "^1.2.0",
"react-native-emoji": "1.8.0",
"react-native-exit-app": "^1.1.0",
"react-native-file-picker": "0.0.19",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "1.5.6",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.28.0",
"react-native-image-picker": "2.3.4",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-item-select": "0.3.0",
"react-native-modal": "11.5.6",
"react-native-modalbox": "2.0.2",
"react-native-motion": "1.0.5",
"react-native-otp-verify": "^1.0.3",
"react-native-persian-calendar-picker": "^3.1.1",
"react-native-popup-dialog": "0.18.3",
"react-native-progress": "4.1.2",
"react-native-push-notification": "^7.3.1",
"react-native-rate": "^1.2.4",
"react-native-ratings": "^7.4.0",
"react-native-reanimated": "~1.4.0",
"react-native-root-toast": "3.2.1",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-sectioned-multi-select": "0.8.1",
"react-native-select-contact": "^1.5.0",
"react-native-simple-modal": "^9.0.1",
"react-native-simple-radio-button": "^2.7.4",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "0.11.0",
"react-native-sqlite-storage": "^5.0.0",
"react-native-stars": "^1.2.2",
"react-native-step-indicator": "^1.0.3",
"react-native-svg": "9.13.3",
"react-native-svg-charts": "5.4.0",
"react-native-swiper": "^1.6.0",
"react-native-table-component": "^1.2.1",
"react-native-textinput-effects": "^0.5.1",
"react-native-typing-animation": "^0.1.7",
"react-native-uuid-generator": "^6.1.1",
"react-native-vector-icons": "6.7.0",
"react-native-view-more-text": "^2.1.0",
"react-native-web": "^0.11.7",
"react-native-webview": "^11.4.1",
"react-navigation": "4.4.3",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "2.10.1",
"react-number-format": "4.4.1",
"react-redux": "7.2.2",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"socket.io-client": "^2.4.0",
"styled-components": "5.2.1",
"victory-native": "^33.0.1"
},
"devDependencies": {
"#babel/core": "7.12.3",
"#babel/runtime": "7.12.1",
"#react-native-community/eslint-config": "^0.0.7",
"babel-jest": "25.5.1",
"eslint": "^6.8.0",
"jest": "25.5.4",
"jetifier": "1.6.6",
"metro-react-native-babel-preset": "^0.58.0",
"react-native-bundle-visualizer": "2.2.1",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
this is secound file package.json
{
"name": "mazeapp",
"version": "2.1.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#miblanchard/react-native-slider": "^2.0.1",
"#react-native-community/async-storage": "1.12.1",
"#react-native-community/checkbox": "0.3.0",
"#react-native-community/netinfo": "4.6.0",
"#react-native-community/toolbar-android": "^0.2.1",
"#react-native-firebase/analytics": "^14.0.0",
"#react-native-firebase/app": "^14.0.0",
"#react-native-firebase/messaging": "^14.0.0",
"axios": "^0.19.0",
"lottie-react-native": "3.5.0",
"moment-jalaali": "^0.9.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native": "^0.66.4",
"react-native-app-intro-slider": "4.0.4",
"react-native-awesome-alerts": "1.4.2",
"react-native-background-actions": "^2.6.4",
"react-native-background-timer": "2.4.1",
"react-native-check-box": "^2.1.7",
"react-native-confirmation-code-field": "^7.2.0",
"react-native-device-info": "5.6.5",
"react-native-emoji": "1.8.0",
"react-native-exit-app": "^1.1.0",
"react-native-file-picker": "0.0.19",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "1.5.6",
"react-native-image-crop-picker": "^0.28.0",
"react-native-image-picker": "2.3.4",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-item-select": "0.3.0",
"react-native-modal": "11.5.6",
"react-native-modalbox": "2.0.2",
"react-native-motion": "1.0.5",
"react-native-otp-verify": "^1.0.3",
"react-native-persian-calendar-picker": "^3.1.1",
"react-native-progress": "4.1.2",
"react-native-push-notification": "^7.3.1",
"react-native-rate": "^1.2.4",
"react-native-ratings": "^7.4.0",
"react-native-reanimated": "~1.4.0",
"react-native-root-toast": "^3.3.0",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "2.0.0-alpha.12",
"react-native-select-contact": "^1.5.0",
"react-native-simple-modal": "^9.0.1",
"react-native-simple-radio-button": "^2.7.4",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "0.11.0",
"react-native-sqlite-storage": "^5.0.0",
"react-native-stars": "^1.2.2",
"react-native-step-indicator": "^1.0.3",
"react-native-svg": "^9.13.3",
"react-native-svg-charts": "5.4.0",
"react-native-swiper": "^1.6.0",
"react-native-textinput-effects": "^0.5.1",
"react-native-typing-animation": "^0.1.7",
"react-native-uuid-generator": "^6.1.1",
"react-native-vector-icons": "^9.0.0",
"react-native-view-more-text": "^2.1.0",
"react-native-web": "^0.11.7",
"react-native-webview": "^11.4.1",
"react-navigation": "4.4.3",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.10.1",
"react-number-format": "4.4.1",
"react-redux": "7.2.2",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"socket.io-client": "^2.4.0",
"victory-native": "^33.0.1"
},
"devDependencies": {
"#babel/core": "7.16.5",
"#babel/runtime": "7.16.5",
"#react-native-community/eslint-config": "2.0.0",
"babel-jest": "26.6.3",
"eslint": "7.14.0",
"jest": "26.6.3",
"jetifier": "1.6.6",
"metro-react-native-babel-preset": "0.66.2",
"react-native-bundle-visualizer": "2.2.1",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
// googlePlayServicesVersion = "4.3.3" // default: "+"
// firebaseMessagingVersion = "+" // default: "+"
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://jitpack.io' }
}
}
For those having a similar issue or that have to explain to the Play Store why this permission is in place, this is added by react-native-inappbrowser-reborn package, there is a PR to fix that here:
https://github.com/proyecto26/react-native-inappbrowser/pull/335
It seems that at the time writing this post, it's not live in the NPM directory. But you should try to update the package and see if its gone.
One way to figure out which dependency injects permissions is by running this command at the root of your project (on unix based OS):
grep -r QUERY_ALL_PACKAGES *
This will tell you the file that has that text and this will point you on the right direction.
It is because of target SDK updated to 30, some features (eg: Speech recognition,TTS) works in from android 11 device only after adding following code in our AndroidManifest.xml
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:node="remove" tools:ignore="QueryAllPackagesPermission" />
also android:exported="true" inside <activity>
It is mentioned in here Behavior changes: Apps targeting Android 11
You might have to exclusively declare the tools namespace in the manifest header tag for this to work. xmlns:tools="http://schemas.android.com/tools" so that the header will look like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app">
You can confirm that the package is included in your apk using.
apkTook
install using instructions on website
build your apk
run apktool decode /path/to/your/app-release.apk
There should now be a giant merged manifest file containing all permissions for your apk.
Once you have confirmed that the permission is included in your apk.
You can then use #imekinox 's answer to detect which dependency is including the permission.
You can then chose to disable the permission from appearing in your final APk file
by including the following change in your manifest.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.cortexmonitoring">
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:node="remove" tools:ignore="QueryAllPackagesPermission" />
Notice that xmlns:tools="http://schemas.android.com/tools" is required at the top of the manifest file.
More than likely the issue is https://github.com/proyecto26/react-native-inappbrowser/pull/335 and disabling the permission in this way may break this or other packages.
The real fix would be removing or updating any dependencies that include this permission.
for the ones who follow #Thanhal's answer:
check your AndroidManifest.xml file and add
xmlns:tools="http://schemas.android.com/tools"
to the manifest markup if it's not there.
example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="your-app-package">
#imekinox has the correct solution, however, after I went to the Github page he linked, the fix for react-native-inappbrowser is merged but no new release with it has been published yet.
I found another NPM release that has it included:
https://www.npmjs.com/package/#jinshin1013/react-native-inappbrowser-reborn
Uninstall the old version and install this version and that should fix it.
There is great probability that your app will get rejected by Play store if you use QUERY_ALL_PACKAGES permission.
As mentioned in below link "In the rare cases where the element doesn't provide adequate package visibility, you can use the QUERY_ALL_PACKAGES permission. If you publish your app on Google Play, your app's use of this permission is subject to approval."
https://developer.android.com/training/package-visibility
Add queries to AndroidManifest.xml file as mentioned below.
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
</intent>
</queries>

babel-relay-plugin with react-native (expo) throwing error about 'cypto'

I am trying to implement react-relay in an expo project using the babel-plugin-relay package.
It was working on expo web (npm run web), but when I went to run it on my android device (npm start) this error happened.
The Error
The package at "node_modules/babel-plugin-relay/lib/compileGraphQLTag.js" attempted to import the Node standard library module "crypto". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
My Configuration
// babel.config.js
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
['relay']
]
};
};
// package.json
"dependencies": {
"#absinthe/socket-relay": "^0.2.1",
"#expo/vector-icons": "^10.2.1",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/bottom-tabs": "^5.11.1",
"#react-navigation/native": "^5.8.9",
"#react-navigation/stack": "^5.12.6",
"expo": "~39.0.2",
"expo-asset": "^8.2.0",
"expo-constants": "^9.2.0",
"expo-font": "^8.3.0",
"expo-linking": "^1.0.5",
"expo-splash-screen": "^0.6.2",
"expo-status-bar": "~1.0.2",
"expo-web-browser": "^8.5.0",
"phoenix": "^1.5.6",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
"react-native-gesture-handler": "^1.8.0",
"react-native-paper": "^4.3.1",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.14.0",
"react-native-web": "^0.13.18",
"react-relay": "^10.0.1",
"relay-runtime": "^10.0.1"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"babel-plugin-relay": "^10.0.1",
"graphql": "^15.4.0",
"relay-compiler": "^10.0.1"
},
// relay.config.js
module.exports = {
src: './src',
schema: './schema.graphql',
exclude: [
'**/node_modules/**',
'**/__mocks__/**',
'src/__generated__/**'
],
};
I am using the babel-plugin-relay/macro for composing graphql fragments (import graphql from "babel-plugin-relay/macro";).
If someone could help me resolve this I would really appreciate it. Thanks.