Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all 29632 articles
Browse latest View live

Task :app:copyReactNativeVectorIconFonts FAILED

$
0
0

Hello i programing a react-native which assembleDebug work but assembleRealease dont. i dont know why this happen & i solutions on internet dont work

What can i do?

> Task :app:copyReactNativeVectorIconFonts FAILED                                                                                                  FAILURE: Build failed with an exception.* What went wrong:Some problems were found with the configuration of task ':app:copyReactNativeVectorIconFonts' (type 'Copy').  - Gradle detected a problem with the following location: 'D:\Cosas\UTN\APPMOVIL\HayEquipo\hayEquipo\android\app\build\intermediates\ReactNativeVectorIcons\fonts'.    Reason: Task ':app:lintVitalReportRelease' uses this output of task ':app:copyReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.    Possible solutions:      1. Declare task ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintVitalReportRelease'.      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' using Task#dependsOn.      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalReportRelease' using Task#mustRunAfter.           Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.        - Gradle detected a problem with the following location: 'D:\Cosas\UTN\APPMOVIL\HayEquipo\hayEquipo\android\app\build\intermediates\ReactNativeVectorIcons\fonts'.    Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:copyReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.    Possible solutions:      1. Declare task ':app:copyReactNativeVectorIconFonts' as an input of ':app:lintVitalAnalyzeRelease'.      2. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#dependsOn.      3. Declare an explicit dependency on ':app:copyReactNativeVectorIconFonts' from ':app:lintVitalAnalyzeRelease' using Task#mustRunAfter.          Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.      BUILD FAILED in 1m 6s318 actionable tasks: 14 executed, 304 up-to-date

React Native - What is reactTag parameter in AccessibilityInfo.setAccessibilityFocus()?

$
0
0

What is reactTag parameter in AccessibilityInfo.setAccessibilityFocus(reactTag) method? React native documentation don't provide any information about this parameter:

Set accessibility focus to a React component. On Android, this is equivalent to UIManager.sendAccessibilityEvent(reactTag, UIManager.AccessibilityEventTypes.typeViewFocused);.

I don't have any background of Objective-C and Java. A little example will be more appreciated. Thank !!!

requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager when running android app

$
0
0

When running an application on android i get this error. It builds correctly but crashes with exception. I have installed React-native-screens, @React-native/navigation and the dependencies listed on https://reactnavigation.org/docs/getting-started/

com.facebook.react.common.JavascriptException: Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.

This error is located at:    in RNSScreenStackHeaderConfig    in Unknown    in RNSScreen    in N    in ForwardRef    in y    in E    in RNSScreenStack    in w    in RNCSafeAreaProvider    in Unknown    in v    in Unknown    in Unknown    in Unknown    in ForwardRef    in Unknown    in ForwardRef    in p    in c    in P    in RCTView    in View    in RCTView    in View    in h, stack:

It builds and runs on iOS fine but when running on android it crashes completely. Is there something I am overlooking here?

This is my Package json.

{"name": "<myprojectname>","version": "0.0.1","private": true,"scripts": {"android": "react-native run-android","ios": "react-native run-ios","start": "react-native start","test": "jest","lint": "eslint .","postinstall": "npx jetify","android:bundle:debug": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/"  },"dependencies": {"@react-native-community/async-storage": "^1.8.1","@react-native-community/masked-view": "^0.1.11","@react-navigation/native": "^6.0.2","@react-navigation/native-stack": "^6.1.0","@react-navigation/stack": "^6.0.7","adbkit": "^2.11.1","moment": "^2.24.0","react": "16.9.0","react-native": "0.63.0","react-native-calendar-strip": "^1.4.1","react-native-calendars": "^1.264.0","react-native-firebase": "^5.6.0","react-native-gesture-handler": "^1.10.3","react-native-reanimated": "^2.2.0","react-native-safe-area-context": "^3.3.1","react-native-screens": "3.1.1","react-native-snap-carousel": "^3.8.4","react-native-vector-icons": "^6.6.0","react-navigation": "^4.4.4","react-navigation-stack": "^2.10.4","react-redux": "^7.2.0","redux": "^4.0.5"  },"devDependencies": {"@babel/core": "^7.15.0","babel-jest": "24.9.0","eslint": "^6.5.1","jest": "24.9.0","jetifier": "^1.6.5","metro-react-native-babel-preset": "^0.66.2","react-test-renderer": "16.9.0"  },"jest": {"preset": "react-native"  }}

I dont really know how to solve this, have tried removing caches, restarting metro, deleting node modules and all "related" errors. This error even happens when I create a fresh project and try installing and using the navigation library.

This is my entrypoint, example copied from React-navigation snack.

import * as React from 'react';import { View, Text } from 'react-native';import { NavigationContainer } from '@react-navigation/native';import { createNativeStackNavigator } from '@react-navigation/native-stack';import { enableScreens } from 'react-native-screens';enableScreens(true);function HomeScreen() {  return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Home Screen</Text></View>  );}function DetailsScreen() {  return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Details Screen</Text></View>  );}const Stack = createNativeStackNavigator();function AppTest() {  return (<NavigationContainer><Stack.Navigator       screenOptions={{        headerStyle: {          backgroundColor: '#f4511e',        },        headerTintColor: '#fff',        headerTitleStyle: {          fontWeight: 'bold',        },      }}      initialRouteName="Home"><Stack.Screen  options={{ title: 'My home' }} name="Home" component={HomeScreen} /><Stack.Screen  options={{ title: 'My home' }} name="Details" component={DetailsScreen} /></Stack.Navigator></NavigationContainer>  );}export default AppTest;

Any suggestions?

Microsoft SSO, Android. press "continue", does nothing. React native firebase

$
0
0

Problem

React native Firebase, Microsoft SSO for Android.

When I attempt to sign in, and press "continue" it does nothing.After pressing continue 5 times, message of too many attempts shows up.

enter image description here

Setup

  • React native Firebase, Google SSO works fine. (can rule out internet conn)
  • code client id and redirect sources
    • client id is from the entra > app registration > overview > app client id
    • redirect uri is from entra > app registration > authentication > android card > redirect uri.
      • redirect uri looks something like msauth://com.myappname.dev/FAaX%2123454lc2OAabcdedgh6s%3Denter image description here
  • made sure the package name matches my app package name.
  • in the Entra auth page,
    • ID tokens (used for implicit and hybrid flows) and Access tokens (used for implicit flows) are checked.
    • Allow public client flows set to yes.
  • In firebase auth page, added my client id and secret to that microsoft sign in section. client id and secret are from entra app registrations.
// my codeimport AzureAuth from 'react-native-azure-auth' // 1.8.9const azureAuth = new AzureAuth({  clientId: Config.MICROSOFT_CLIENT_ID,  redirectUri: Config.MICROSOFT_REDIRECT_URI_ANDROID})const tokens = await azureAuth.webAuth.authorize({   scope: 'email openid profile User.Read offline_access',   prompt: 'select_account'})console.log('tokens') // <--- never gets to here

How can i change notification icon background color

$
0
0

enter image description here

I want to change my apps notification icon as other notification. I'm using react-native-push-notifications module. I tried update Androidmanifest.xml but it didnt work. It has drawable and mipmap and color folder.

Admob : Ad serving is limited - The number of ads you can show has been limited. For details, go to the Policy center

$
0
0

I'm new to admob. I published my first android app (written in expo react-native). I followed the instructions https://docs.expo.dev/versions/latest/sdk/admob/ on including admob ads in my app. But after sometime of including the ad Ids for Banner Ad, Interstitial Ad and Reward Ad I get this message "Ad serving is limited The number of ads you can show has been limited. For details, go to the Policy center" in my admob account.

It says "Invalid traffic concerns". I followed the below links but it didn't help me resolve it

https://support.google.com/admob/answer/3342099?hl=enhttps://oko.uk/blog/ad-serving-has-been-limited

enter image description here

enter image description here

Resolutions I followed but none of these helped

  1. Removed all 3 ads i,e, Banner Ad, Interstitial Ad and Reward Ad. After waiting for couple of days (5 days or so) this message was removed. After one day I again created these ads and implemented their Ids in my app and released it on Google Play Store. Ads did not show in my app but still, after 2 days I again got this "invalid traffic concerns" message on my account.

  2. Implemented frequency capping for the ads but that didn't help. Ads are not showing on my app yet.

  3. I've implemented ads.txt properly.

  4. I've added the payment details on the account.

  5. Implemented the test ad Ids and they worked. But when replaced with real Ad Ids they don't work.

None of these helped me. Please let me know how to proceed on this.

By the way, this is my app - https://play.google.com/store/apps/details?id=com.starcoding.matchmeifucan_cow_bull

Thanks.

React Native 0.74.0 Android builds fail "cannot find symbol import com.facebook.react.fabric.FabricJSIModuleProvider"

$
0
0

After upgrading to RN 0.74.0 the npx react-native run-android fails with the error -

error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081/Users/phil/Code/app-name/android/app/src/main/java/com/app-name/app/newarchitecture/MainApplicationReactNativeHost.java:19: error: cannot find symbolimport com.facebook.react.fabric.FabricJSIModuleProvider; ^ symbol: class FabricJSIModuleProvider location: package com.facebook.react.fabric

I've followed the steps in upgrading from 0.7.3.6 to 0.74.0 using the Upgrade Helper. iOS builds are okay but facing this issue with Android builds. I understand this is related to using the New Architecture, however I have newArchEnabled=false setting in gradle.properties.

React-Native Build Failed - Terminal

$
0
0

I create react-native project on my laptop and it builds successfully.

But with the same project I try to run it on my desktop pc but it gives an error build failed.

I updated gradle. I edited the sdks. I followed the documentation exactly. I have created a project with expo before. This is my first react-native CLI project

enter image description here


At least one field required in yup: Error: Cyclic dependency, node was:"reqNumber", js engine: hermes"

$
0
0

I'm creating an form with three fields. The first (driver) is required, so it's easy to do it with yup. But for the others 2 fields (fiscalNote & reqNumber) at least one of them should be required. Example: if "fiscalNote" is empty "reqNumber" should be required, and if "redNumber" is empty "fiscalNote" should be required.I've tried a lot of things, but I'm getting every types of errors, like: "Error: Cyclic dependency, node was:"reqNumber", js engine: hermes".

I also tried add an Array with the fields name in the yup shape but I think the newest versions don't has supports. That is my code now:

import * as yup from "yup"import { yupResolver } from "@hookform/resolvers/yup"type FirstStepFields = {    driver: string,    fiscalNote?: string,    reqNumber?: string}const firstStepFieldsSchema = yup.object().shape({    driver: yup.string().required("Error message"),    fiscalNote: yup.string().notRequired().when('reqNumber', {        is: (reqNumber: string) => !reqNumber || reqNumber.length === 0,        then: (schema) => schema.required("Error message")    }),    reqNumber: yup.string().notRequired().when('fiscalNote', {        is: (fiscalNote: string) => !fiscalNote || fiscalNote.length === 0,        then: (schema) => schema.required("Insira uma Nota Fiscal ou um N° de Requisição")    }),})const { control, handleSubmit, formState: {errors} } = useForm<FirstStepFields>({    resolver: yupResolver<FirstStepFields>(firstStepFieldsSchema)})

yup version:

"yup": "^1.4.0","react": "18.2.0","react-native": "0.73.6",

onAccessibilityEvent not being triggered and app constantly crashing

$
0
0

I'm new to mobile development and my first app was, what I though, a simple app that reads the screen when a scpefic app's overlay pops up, or pushes a notification.

Since I'm familiar with React I went with the approach React Native + Native Modules and Kotlin for native code. So far I'm able to do mostly everything I need, I've implemented a NotificationListenerService for the notifications and to retrive the screen's text I'm trying to use an AccessibilityService.

I'm able to trigger the onServiceConnected from the service, and pass any info to the app with HeadlessJsTaskService, and only twice of all attempts I could see a console.log from what onAccessiblityEvent sent, that's why I still didn't give up, but I'm not sure how I did it.

Also after I enable the accessibility permissions at my device's settings I get the onServiceConnected log, but the app starts to crash, it sometimes opens normally, but most of the time it closes immediately after openning it, I suspect that the device disable the apps pemission because instead of enabled or disabled it says app not working that's why it starts to open without any crash again, but I'm not sure. All other events like onUnbind works fine just the onAccessibilityEvent that I can't trigger for anything.

I'm using the latest version of Expo with React Native local library native module, but also tried an app with the React Native CLI. The physical device I'm using to test is a Samsumg A54 with android 14.

This code is from the Native Module:

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.accessibilityservice"><application        android:allowBackup="false"><service android:name=".AccessibilityServiceHeadlessJsTaskService" /><service android:name=".MyAccessibilityService"            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"            android:enabled="true"            android:exported="true"><intent-filter><action android:name="android.accessibilityservice.AccessibilityService" /></intent-filter><meta-data                android:name="android.accessibilityservice"                android:resource="@xml/accessibility_service_config" /></service></application></manifest>

accessibility_service_config.xml

<!-- At this point I was trying to capture any event --><accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"    android:accessibilityEventTypes="typeViewTextChanged|typeViewFocused|typeViewLongClicked|typeViewClicked|typeViewScrolled|typeWindowStateChanged"    android:accessibilityFeedbackType="feedbackHaptic"    android:accessibilityFlags="flagIncludeNotImportantViews"    android:canRetrieveWindowContent="true"    android:notificationTimeout="100"

MyAccessibilityService.kt

For now all functions are like this so I can log at the React Native's side

    override fun onServiceConnected() {        super.onServiceConnected()        val serviceIntent = Intent(            applicationContext,            AccessibilityServiceHeadlessJsTaskService::class.java        )        serviceIntent.putExtra("screenText", "This is from the onServiceConnected")        HeadlessJsTaskService.acquireWakeLockNow(applicationContext)        applicationContext.startService(serviceIntent)    }    override fun onAccessibilityEvent(event: AccessibilityEvent?) {        val serviceIntent = Intent(            applicationContext,            AccessibilityServiceHeadlessJsTaskService::class.java        )        serviceIntent.putExtra("screenText", "An event occured")        HeadlessJsTaskService.acquireWakeLockNow(applicationContext)        applicationContext.startService(serviceIntent)    }

The code to console.log the Native Module's data

import { AppRegistry } from "react-native";import App from "./App";const headlessAccessibilityService = async ({ screenText }) => {  console.log(screenText);};AppRegistry.registerHeadlessTask("AccessibilityServiceHeadlessJs",  () => headlessAccessibilityService);AppRegistry.registerComponent("expo-screen-reader", () => App);

React Native, Execution failed for task ':app:mergeDexDebug'

$
0
0

I'm trying to run my app in physical device but getting that error. I tried to clean gradlew with cd android and ./gradlew clean. I also tried to clean cache but it's giving that error. I just install the react navigation and stack navigation after that I'm getting that error I also tried to reinstall navigation packages but still getting same error. Can anyone help me please? error and package.json is below

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:mergeDexDebug'.> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:     The number of method references in a .dex file cannot exceed 64K.     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

package.json

"dependencies": {"@react-native-community/google-signin": "^5.0.0","@react-native-community/masked-view": "^0.1.10","@react-navigation/native": "^5.8.4","@react-navigation/stack": "^5.12.1","is_js": "^0.9.0","react": "16.13.1","react-native": "^0.63.1","react-native-fbsdk": "^2.0.0","react-native-flash-message": "^0.1.16","react-native-gesture-handler": "^1.8.0","react-native-localization": "^2.1.6","react-native-reanimated": "^1.13.1","react-native-safe-area-context": "^3.1.8","react-native-screens": "^2.12.0","react-native-vector-icons": "^7.1.0","react-native-webview": "^10.10.0"  },

After switching from Windows 10 to Ubuntu 22.04: Facing an issue while Running Previous React Native Projects

$
0
0

enter image description hereI've been working with React Native for a year now. Previously, I was using Windows, but I recently switched to Ubuntu and intend to stick with it. The reason for the switch is that Windows was somewhat laggy and took a lot of time to generate builds. I've configured the environment according to the instructions in the React Native documentation. The project runs properly and the app installs on the device, but after loading, it displays a strange error screen (screenshot attached). I would greatly appreciate any help in resolving this issue, as I've been stuck on it for a week.

Error screenShort (https://www.imghippo.com/i/Bfeon1714116280.png)

Detox error after Android app opens: Failed to run application on the device

$
0
0

I am new to Detox and am at the point of just trying to get a basic test running successfully.

After running detox test --configuration android.emu.debug the app opens successfully, but then just hangs and eventually I get the following errors:

10:56:55.138 detox[51659] B jest --config e2e/jest.config.js10:56:58.042 detox[51660] i Babel config: myApp sandbox debug10:56:58.489 detox[51660] i login.test.js is assigned to emulator-5554 (Pixel_7_Pro_API_33)11:00:07.190 detox[51660] i ToS Accept: should show ToS screen11:00:07.202 detox[51660] i ToS Accept: should show ToS screen [FAIL]11:00:07.301 detox[51660] i An error occurred while waiting for the app to become ready. Waiting for disconnection...  error: Failed to run application on the device  HINT: Most likely, your main activity has crashed prematurely.  Native stacktrace dump:  com.wix.detox.common.DetoxErrors$DetoxRuntimeException: Waited for the new RN-context for too long! (180 seconds)  If you think that's not long enough, consider applying a custom Detox runtime-config in DetoxTest.runTests().        at com.wix.detox.reactnative.ReactNativeLoadingMonitor.awaitNewRNContext(ReactNativeLoadingMonitor.kt:60)        at com.wix.detox.reactnative.ReactNativeLoadingMonitor.getNewContext(ReactNativeLoadingMonitor.kt:29)        at com.wix.detox.reactnative.ReactNativeExtension.awaitNewReactNativeContext(ReactNativeExtension.kt:129)        at com.wix.detox.reactnative.ReactNativeExtension.waitForRNBootstrap(ReactNativeExtension.kt:36)        at com.wix.detox.DetoxMain.launchActivity(DetoxMain.kt:127)        at com.wix.detox.DetoxMain.launchActivityOnCue(DetoxMain.kt:53)        at com.wix.detox.DetoxMain.run(DetoxMain.kt:33)        at com.wix.detox.Detox.runTests(Detox.java:126)        at com.wix.detox.Detox.runTests(Detox.java:93)        at de.mcoins.applike.DetoxTest.runDetoxTests(DetoxTest.java:27)11:00:07.362 detox[51660] i The app disconnected.11:00:07.364 detox[51660] i The pending request #-49642 ("cleanup") has been rejected due to the following error:The app has unexpectedly disconnected from Detox server. FAIL  e2e/login.test.js (191.641 s)  ToS Accept✕ should show ToS screen (7 ms)● ToS Accept › should show ToS screen    thrown: "Exceeded timeout of 120000 ms for a hook.    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."      1 | describe('ToS Accept', () => {> 2 |   beforeAll(async () => {        |   ^      3 |     await device.launchApp();      4 |   });      5 |      at beforeAll (e2e/login.test.js:2:3)      at Object.describe (e2e/login.test.js:1:1)Test Suites: 1 failed, 1 totalTests:       1 failed, 1 totalSnapshots:   0 totalTime:        191.828 sRan all test suites.11:00:07.491 detox[51659] E Command failed with exit code = 1:jest --config e2e/jest.config.js

I have looked around at previous issues like this, but everybody seemed to have something wrong with their setup. In my case I followed the Detox setup guide and I cannot see what is missing.

My detoxrc.js:

/** @type {Detox.DetoxConfig} */module.exports = {  testRunner: {    args: {'$0': 'jest',      config: 'e2e/jest.config.js'    },    jest: {       setupTimeout: 120000    }  },  apps: {'myApp.android.debug': {      type: 'android.apk',      binaryPath: 'android/app/build/outputs/apk/myApp/debug/myApp-debug-v504.apk',      testBinaryPath: 'android/app/build/outputs/apk/androidTest/myApp/debug/app-myApp-debug-androidTest.apk',      build: 'cd android && ./gradlew assemblemyAppSandboxDebug assembleAndroidTest -DtestBuildType=debug',      reversePorts: [        8081      ]    }  },  devices: {    attached: {      type: 'android.attached',      device: {        adbName: '.*'      }    },    emulator: {      type: 'android.emulator',      device: {        avdName: 'Pixel_7_Pro_API_33'      }    }  },  configurations: {'ios.sim.debug': {      device: 'simulator',      app: 'ios.debug'    },'ios.sim.release': {      device: 'simulator',      app: 'ios.release'    },'android.att.debug': {      device: 'attached',      app: 'myApp.android.debug'    },'android.att.release': {      device: 'attached',      app: 'android.release'    },'android.emu.debug': {      device: 'emulator',      app: 'myApp.android.debug'    },'android.emu.release': {      device: 'emulator',      app: 'android.release'    }  }};

My DetoxTest.java:

package com.example.myApp;import com.wix.detox.Detox;import com.wix.detox.config.DetoxConfig;import org.junit.Rule;import org.junit.Test;import org.junit.runner.RunWith;import androidx.test.ext.junit.runners.AndroidJUnit4;import androidx.test.filters.LargeTest;import androidx.test.rule.ActivityTestRule;@RunWith(AndroidJUnit4.class)@LargeTestpublic class DetoxTest {    @Rule // (2)    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);    @Test    public void runDetoxTests() {        DetoxConfig detoxConfig = new DetoxConfig();        detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;        detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;        detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60);        Detox.runTests(mActivityRule, detoxConfig);    }}

My test suite:

describe('ToS Accept', () => {  beforeAll(async () => {    await device.launchApp();  });  beforeAll(async () => {    await device.reloadReactNative();  });  it('should show ToS screen', async () => {    await expect(element(by.id('TosTitle'))).toBeVisible();  });});

Build Failed Could not find method signingConfigs()

$
0
0

I follow in official website : https://facebook.github.io/react-native/docs/signed-apk-android.html

it said line: 128 errorwhich issigningConfigs signingConfigs.release

in android/app/build.gradle

 signingConfigs {        release {            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {                storeFile file(MYAPP_RELEASE_STORE_FILE)                storePassword MYAPP_RELEASE_STORE_PASSWORD                keyAlias MYAPP_RELEASE_KEY_ALIAS                keyPassword MYAPP_RELEASE_KEY_PASSWORD            }        }    }    buildTypes {        release {            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"            signingConfigs signingConfigs.release        }    }

in android/.gradle/gradle.properties

MYAPP_RELEASE_STORE_FILE=ezam.keystoreMYAPP_RELEASE_KEY_ALIAS=ezamMYAPP_RELEASE_STORE_PASSWORD=*****MYAPP_RELEASE_KEY_PASSWORD=*****

React native gets created but not running on windows 10. I have installed sdk tools and emulators using android studio

$
0
0

I am trying to install react native in my windows system. When I create app using following command:

npx react-native init MyApp

App folder gets created. But when I run this app using following command:

npx react-native run android, it fails with following exception

  • What went wrong:java.io.UncheckedIOException: Could not move temporary workspace (E:\ReactNativeApps\App02\android.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a-8c313250-1ca8-434c-88f6-83ace558c4e2) to immutable location (E:\ReactNativeApps\App02\android.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a)

Could not move temporary workspace (E:\ReactNativeApps\App02\android.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a-8c313250-1ca8-434c-88f6-83ace558c4e2) to immutable location (E:\ReactNativeApps\App02\android.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a)```.

I have installed android studio with sdk platform and sdk tools. Can anyone please help?


npx react-native run-android: E/Device: Error during Sync: EOF

$
0
0

I am trying to run react native app to my real android device.I checked my device before running

adb devicesList of devices attached3357425441473098        device

I started with

npx react-native start

and in other console

npx react-native run-android

But got an error..

Task :app:installDebug FAILED                                                                                                                                                     10:25:40 V/ddms: execute: running am get-config                                                                                                                                     10:25:40 V/ddms: execute 'am get-config' on '3357425441473098' : EOF hit. Read: -1                                                                                                  10:25:40 V/ddms: execute: returning                                                                                                                                                 Installing APK 'app-debug.apk' on 'SM-G960U - 9' for app:debug                                                                                                                      10:25:40 D/app-debug.apk: Uploading app-debug.apk onto device '3357425441473098'10:25:40 D/Device: Uploading file onto device '3357425441473098'10:25:40 D/ddms: Reading file permision of /home/user/react-native/awesomeProject/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--                10:25:40 D/ddms: read: channel EOF                                                                                                                                                  10:25:40 E/Device: Error during Sync: EOF                                                                                                                                           Unable to install /home/user/react-native/awesomeProject/android/app/build/outputs/apk/debug/app-debug.apk                           com.android.ddmlib.InstallException: EOF      

And right after that error. I lost my device connection.

adb devices

shows nothing..

and at the bottom of stacktrace I see this error also

Caused by: java.io.IOException: EOF        at com.android.ddmlib.AdbHelper.read(AdbHelper.java:862)        at com.android.ddmlib.SyncService.doPushFile(SyncService.java:712)        at com.android.ddmlib.SyncService.pushFile(SyncService.java:406)        at com.android.ddmlib.Device.syncPackageToDevice(Device.java:988)        at com.android.ddmlib.Device.installPackage(Device.java:902)

FAILURE: Build failed with an exception.

* What went wrong:Execution failed for task ':app:installDebug'.> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: EOF* 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.orgBUILD FAILED in 10s    at checkExecSyncError (child_process.js:629:11)    at execFileSync (child_process.js:647:13)    at runOnAllDevices (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)    at buildAndRun (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)    at then.result (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)    at process._tickCallback (internal/process/next_tick.js:68:7)

My device is us samsumg galaxy s9. It was working when I use Expo sdk. What is my problem?

react-native : 0.61.5

Weird thing is that it works first execution after computer boot. then I tried reconnect phone, and it pops up again.

Could not find method exec() for arguments. Android Build Error

$
0
0

react-native project randomly started failing with

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@45d8ac1c] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

while running yarn android

It starts the JS serverstarts the emulator then fails

We have not changed anything in gradle and all versions are mentioned.

Original CLI error

A problem occurred evaluating script.Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@2763a6b8] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

Path/package where error is occuring

node_modules/@react-native-community/cli-platform-android/native_modules.gradle

Exact code snippet where error is occuring

  /**   * Runs a specified command using providers.exec in a specified directory.   * Throws when the command result is empty.   */  String getCommandOutput(String[] command, File directory) {    try {      def execOutput = providers.exec { // the error is occuring here        commandLine(command)        workingDir(directory)      }      def output = execOutput.standardOutput.asText.get().trim()      if (!output) {        this.logger.error("${LOG_PREFIX}Unexpected empty result of running '${command}' command.")        def error = execOutput.standardError.asText.get().trim()        throw new Exception(error)      }      return output    } catch (Exception exception) {      this.logger.error("${LOG_PREFIX}Running '${command}' command failed.")      throw exception    }  }

How to fix jlink does not exist?

$
0
0

i am working with react native and am trying to use expo in a bare project but whenever i try to run the app with the command npm run android, i get this error :

Execution failed for task ':expo-modules-core:compileDebugJavaWithJavac'.> Could not resolve all files for configuration ':expo-modules-core:androidJdkImage'.> Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.> Execution failed for JdkImageTransform: /home/dukizwe/Android/Sdk/platforms/android-31/core-for-system-modules.jar.> jlink executable /usr/lib/jvm/java-14-openjdk-amd64/bin/jlink does not exist.

I am using the linux OS, Android studio and JDK are correctly installed.

Inside /usr/lib/jvm/ folder, the structure look like this:

  • java-1.11.0-openjdk-amd64
  • java-1.14.0-openjdk-amd64
  • java-11-openjdk-amd64
  • java-14-openjdk-amd64
  • jdk-18

i don't know why it's looking in the java-14-openjdk-amd64 folder because in that folder there's no jlink executable.

In android studio the SDK Location si pointed to java-11-openjdk. Any help please ?

Deeplink in react-native with nested navigators, app gets foregrounded but no navigation

$
0
0

I'm trying to deeplink back to my app after a successful authentication in a browser using a redirect URL. There's a few nested navigators in the app itself, so the set up looks like this:

Outer Stack:

        return (<SafeAreaProvider><NavigationContainer                    theme={theme}                    linking={linking}><Stack.Navigator                        screenOptions={{                            headerShown: false,                            gestureEnabled: false                        }}><Stack.Screen name="Login" component={LandingStackScreen} options={{                            gestureEnabled: false,                        }}/><Stack.Screen name="Home" component={HomeTabScreen} options={{                            gestureEnabled: false,                        }}/><Stack.Screen name="Logout" component={LogoutStackScreen} options={{                            gestureEnabled: false,                        }}/><Stack.Screen name="Register" component={RegistrationStackScreen} options={{                            gestureEnabled: false,                        }}/></Stack.Navigator></NavigationContainer></SafeAreaProvider>        )    };}

Inner Stack 1 (Home Stack):

function HomeTabScreen() { return (<HomeTab.Navigator                tabBarOptions={{                    activeTintColor: '#059693',                    inactiveTintColor: 'gray',                }}                sceneContainerStyle={{backgroundColor: 'transparent'}}                tabBar={props => <MyTabBar {...props} key={1} />}><HomeTab.Screen name="Home" component={HomeStackScreen}/><HomeTab.Screen name="Analytics" component={AnalyticsStackScreen}/><HomeTab.Screen name="Add" component={Testing}/><HomeTab.Screen name="Dummy" component={Testing}/><HomeTab.Screen name="Coach" component={CoachDrawerScreen}/><HomeTab.Screen name="Profile" component={SettingsStackScreen}/></HomeTab.Navigator>    );}

And Inner Stack 2 (Analytics Stack):

function AnalyticsStackScreen() {    return (<AnalyticsStack.Navigator            screenOptions={{                headerShown: false,            }}><AnalyticsStack.Screen name="History" component={History} /><AnalyticsStack.Screen name="Trends" component={Trends} /><AnalyticsStack.Screen name="widgetpage" component={widgetPage} /><AnalyticsStack.Screen name="widgetsuccess" component={successfulWidgetLogon} /></AnalyticsStack.Navigator>    );}

I'm trying to have the app redirect to the widgetsuccess component in the Analytics Stack (inner stack 2). I've set up a linking prop like this:

const linking = {    prefixes: ['https://myapp.com', 'myapp://'],    config: {        screens: {            Home: {                screens: {                    Analytics: {                        widgetsuccess: "widgetsuccess?:userId&:resource"                    }                }            }        },    },};

I've also changed the Android Manifest to add the "myapp" scheme and "widgetsuccess" host, alongside the android:launchMode="singleTask" and other intent-filter changes that are required. The redirect url will look like this: "myapp://widgetsuccess?userId=xxx-xxx-xxx&resource=xxx".

When the app successfully authenticates and redirects, it simply takes me back to the same page that the app was on originall. I've tried to just redirect to the initial home page, or any other page really and the same thing happens. I've obviously done something wrong, but can't figure out what, so if anyone has an idea, I would really appreciate the help. Cheers.

RNEncryptedStorage is undefined after updating to the newest react native version

$
0
0

I recently updated my React Native project to the newest version, and now I'm experiencing a problem. The error message isn't clear, and I've been unable to pinpoint the root cause. Here's some context and the code for my test case.

My App.test.js

/** * @format */import "react-native";import React from "react";import App from "../App";// Note: import explicitly to use the types shipped with jest.import { it } from "@jest/globals";// Note: test renderer must be required after react-native.import renderer from "react-test-renderer";it("renders correctly", () => {  renderer.create(<App />);});

Although the test doesn't fail, I still encounter issues when running the app. I've double-checked the Jest setup, and it appears to be correct. I've also looked through related questions and documentation, but couldn't find a suitable solution.

I tried adding some mock tests I found in the web but non of them worked.

Viewing all 29632 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>