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

Imgproc.Canny is throwing unkown exception

$
0
0

I am new to java/openCV world. i am trying to do some edge detection. everything works fine until the code hits Imgproc.Canny and the error message says unkown exception. Can someone help me.

            Mat greyImgMat = new Mat();            Imgproc.cvtColor(inputImageMat, greyImgMat, Imgproc.COLOR_BGR2GRAY);            Mat blur = new Mat();            Imgproc.blur(greyImgMat, blur,  new Size(blurFilterSize, blurFilterSize));            Mat edges = new Mat();            Imgproc.Canny(blur, edges, 50, 255, 3); <- this is where exception is thrown

React native togglebutton play sound

$
0
0

Hi I try 3 libaries(react native -(sound,sound player,play sound) to play sound but I can not play a sound onPress Togglebutton

It gives this error

The error

App.js

import React, { useState } from 'react';import {  View,  Text,  FlatList,  SafeAreaView,  TouchableOpacity,  ImageBackground} from 'react-native';import { PlaySound, StopSound, PlaySoundRepeat, PlaySoundMusicVolume } from 'react-native-play-sound';//FFE990       FFD488     FFE493    E7CE85   E7C287const ToggleButton = (props) => {  const [isPressed, setIsPressed] = useState(false);  const { sample, id, onPress, item1, item2 } = props;  const text = isPressed ? item2.sample2 : item1.sample;  return (<TouchableOpacity      onPress={() => {        setIsPressed(!isPressed);        onPress && onPress();        PlaySound('./john.mp3');      }}      style={{ flex: 1 }}><View        style={{          flex: 1,          width: '100%',          height: 129,          backgroundColor:'#E7C287',          borderWidth: 1,          marginTop:36,          justifyContent: 'center',          alignItems: 'center',          padding:8        }}><Text style={{   fontSize: 14 }}>{text}</Text></View></TouchableOpacity>  );};const ToggleExample = () => {  const data = [    {sample:"Mouse",id:"0"},    {sample:"Mouse2",id:"1"},    ,   , ];  const data2 = [    {sample2:"Disney",id:"0"},{sample2:"Sindirella",id:"1"},];  return (<ImageBackground source={require('./assets/papi2.jpg')}  style={{      flex: 1,      width:'100%',      height:'100%'    }}> <SafeAreaView style={{ flex: 1 ,alignItems: 'center',}}><Text style={{marginTop:21,    padding:16,    marginBottom:27,    fontSize:28,    alignItems: 'center',    }}>Post</Text><FlatList        data={data}        renderItem={(entry) => {          const { item } = entry;          return (<ToggleButton              item1={item}              item2={data2.filter((_item) => _item.id === item.id)[0]}            />          );        }}        contentContainerStyle={{ padding: 20 }}        ItemSeparatorComponent={() => {          return <View style={{ flex: 1, height: 10 }} />;        }}        keyExtractor={(entry, index) => index.toString()}      /></SafeAreaView></ImageBackground>  );};export default ToggleExample;

That's my code on press I try to play "john.mp3" but now it says

"canOverrideExistingModule=true" in the Main activity. I searched, tried to override this func but it still says same

"Native module SoundManager tried to override,Check getPackages() ..."

MainApp.java

package com.post42;import android.app.Application;import android.content.Context;import com.facebook.react.PackageList;import com.facebook.react.ReactApplication;import com.soundapp.SoundModulePackage;import com.facebook.react.ReactInstanceManager;import com.facebook.react.ReactNativeHost;import com.facebook.react.ReactPackage;import com.facebook.soloader.SoLoader;import java.lang.reflect.InvocationTargetException;import java.util.List;public class MainApplication extends Application implements ReactApplication {  private final ReactNativeHost mReactNativeHost =      new ReactNativeHost(this) {        @Override        public boolean getUseDeveloperSupport() {          return BuildConfig.DEBUG;        }        @Override        protected List<ReactPackage> getPackages() {          @SuppressWarnings("UnnecessaryLocalVariable")          List<ReactPackage> packages = new PackageList(this).getPackages();          // Packages that cannot be autolinked yet can be added manually here, for example:          // packages.add(new MyReactNativePackage());          return packages;        }        @Override        protected String getJSMainModuleName() {          return "index";        }      };  @Override  public ReactNativeHost getReactNativeHost() {    return mReactNativeHost;  }  @Override  public void onCreate() {    super.onCreate();    SoLoader.init(this, /* native exopackage */ false);    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());  }  /**   * Loads Flipper in React Native templates. Call this in the onCreate method with something like   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());   *   * @param context   * @param reactInstanceManager   */  private static void initializeFlipper(      Context context, ReactInstanceManager reactInstanceManager) {    if (BuildConfig.DEBUG) {      try {        /*         We use reflection here to pick up the class that initializes Flipper,        since Flipper library is not available in release mode        */        Class<?> aClass = Class.forName("com.post42.ReactNativeFlipper");        aClass            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)            .invoke(null, context, reactInstanceManager);      } catch (ClassNotFoundException e) {        e.printStackTrace();      } catch (NoSuchMethodException e) {        e.printStackTrace();      } catch (IllegalAccessException e) {        e.printStackTrace();      } catch (InvocationTargetException e) {        e.printStackTrace();      }    }  }}

How can I fix it.Thank you

How can I run react native application in widnows 10?

$
0
0

enter image description hereHope evrything is fine.

I am trying to learn react nattive.

I have windows 10 machine.

Hyper -v Is not supported.

So When I try to run my android application using react-native run-android

I am getting the following error in console

Failed to launch emulator. Reason: Emulator exited before boot..

Also my command show loading dependecny graph, doen

How can I fix the Error and make Android Emulator Works in windows 10 ?

If I run emualtor from Android Studio

I get enter image description here

React Native Android: Could not get BatchedBridge, make sure your bundle is packaged correctly

$
0
0

My app is running fine on Android in debug mode. But in release mode it crashes with this error:

com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly

I have enabled bundle in release:

project.ext.react = [  enableHermes: true,  bundleInRelease: true,]

When I inspect my app bundle I can see index.android.bundle in base/assets folder. It is also in build/intermiates/assets.

I am building my app using fastlane:

lane :internal do  android_set_version_code()  gradle(task: "bundleRelease")  supply(track: 'internal', skip_upload_apk: true)end

My React Native version is 0.62.2.

When I try a release with a new RN project it works with same settings.

How can I fix this?

UPDATE:

I have fixed the problem by creating a new RN project and moving my source files to the new project.

React native play sound says set canOverrideExistingModule=true

$
0
0

Hi I try 3 libaries(react native -(sound,sound player,play sound) to play sound but I can not play a sound onPress Togglebutton

It gives this error

The error

App.js

import React, { useState } from 'react';import {  View,  Text,  FlatList,  SafeAreaView,  TouchableOpacity,  ImageBackground} from 'react-native';import { PlaySound, StopSound, PlaySoundRepeat, PlaySoundMusicVolume } from 'react-native-play-sound';//FFE990       FFD488     FFE493    E7CE85   E7C287const ToggleButton = (props) => {  const [isPressed, setIsPressed] = useState(false);  const { sample, id, onPress, item1, item2 } = props;  const text = isPressed ? item2.sample2 : item1.sample;  return (<TouchableOpacity      onPress={() => {        setIsPressed(!isPressed);        onPress && onPress();        PlaySound('./john.mp3');      }}      style={{ flex: 1 }}><View        style={{          flex: 1,          width: '100%',          height: 129,          backgroundColor:'#E7C287',          borderWidth: 1,          marginTop:36,          justifyContent: 'center',          alignItems: 'center',          padding:8        }}><Text style={{   fontSize: 14 }}>{text}</Text></View></TouchableOpacity>  );};const ToggleExample = () => {  const data = [    {sample:"Mouse",id:"0"},    {sample:"Mouse2",id:"1"},    ,   , ];  const data2 = [    {sample2:"Disney",id:"0"},{sample2:"Sindirella",id:"1"},];  return (<ImageBackground source={require('./assets/papi2.jpg')}  style={{      flex: 1,      width:'100%',      height:'100%'    }}> <SafeAreaView style={{ flex: 1 ,alignItems: 'center',}}><Text style={{marginTop:21,    padding:16,    marginBottom:27,    fontSize:28,    alignItems: 'center',    }}>Post</Text><FlatList        data={data}        renderItem={(entry) => {          const { item } = entry;          return (<ToggleButton              item1={item}              item2={data2.filter((_item) => _item.id === item.id)[0]}            />          );        }}        contentContainerStyle={{ padding: 20 }}        ItemSeparatorComponent={() => {          return <View style={{ flex: 1, height: 10 }} />;        }}        keyExtractor={(entry, index) => index.toString()}      /></SafeAreaView></ImageBackground>  );};export default ToggleExample;

That's my code on press I try to play "john.mp3" but now it says

"canOverrideExistingModule=true" in the Main activity. I searched, tried to override this func but it still says same

"Native module SoundManager tried to override,Check getPackages() ..."

MainApp.java

package com.post42;import android.app.Application;import android.content.Context;import com.facebook.react.PackageList;import com.facebook.react.ReactApplication;import com.soundapp.SoundModulePackage;import com.facebook.react.ReactInstanceManager;import com.facebook.react.ReactNativeHost;import com.facebook.react.ReactPackage;import com.facebook.soloader.SoLoader;import java.lang.reflect.InvocationTargetException;import java.util.List;public class MainApplication extends Application implements ReactApplication {  private final ReactNativeHost mReactNativeHost =      new ReactNativeHost(this) {        @Override        public boolean getUseDeveloperSupport() {          return BuildConfig.DEBUG;        }        @Override        protected List<ReactPackage> getPackages() {          @SuppressWarnings("UnnecessaryLocalVariable")          List<ReactPackage> packages = new PackageList(this).getPackages();          // Packages that cannot be autolinked yet can be added manually here, for example:          // packages.add(new MyReactNativePackage());          return packages;        }        @Override        protected String getJSMainModuleName() {          return "index";        }      };  @Override  public ReactNativeHost getReactNativeHost() {    return mReactNativeHost;  }  @Override  public void onCreate() {    super.onCreate();    SoLoader.init(this, /* native exopackage */ false);    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());  }  /**   * Loads Flipper in React Native templates. Call this in the onCreate method with something like   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());   *   * @param context   * @param reactInstanceManager   */  private static void initializeFlipper(      Context context, ReactInstanceManager reactInstanceManager) {    if (BuildConfig.DEBUG) {      try {        /*         We use reflection here to pick up the class that initializes Flipper,        since Flipper library is not available in release mode        */        Class<?> aClass = Class.forName("com.post42.ReactNativeFlipper");        aClass            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)            .invoke(null, context, reactInstanceManager);      } catch (ClassNotFoundException e) {        e.printStackTrace();      } catch (NoSuchMethodException e) {        e.printStackTrace();      } catch (IllegalAccessException e) {        e.printStackTrace();      } catch (InvocationTargetException e) {        e.printStackTrace();      }    }  }}

How can I fix it.Thank you

MapBox dosn't change renderAnnoations when update state in react native ( setState(..) , forceUpdate() have no effect to it )

$
0
0

I change render annotations in my mapview every onPress call of one of data filters buttons , like you see in this code :

import MapboxGL from "@react-native-mapbox-gl/maps";MapboxGL.setAccessToken("mytoken_workign_fine");export default class myClass extends Component{  render_annotaions1 = [{.....},{.....},....];  render_annotaions2 = [{.....},{.....},....];  render_annotaions3 = [{.....},{.....},....];   constructor(props) {      super(props);      this.state = {        filter_state: 1,      };    }  press_filter1(){    if(this.state.filter_state != 1){      this.setState({filter_state:1});    }  }  press_filter2(){  if(this.state.filter_state != 2){    this.setState({filter_state:2});  }  }  press_filter3(){  if(this.state.filter_state != 3){    this.setState({filter_state:3});  }  }  getAnnotations(){  switch(this.state.filter_state ){    case 1:return this.render_annotaions1;    case 2:return this.render_annotaions2;    default:return this.render_annotaions3;  }  }  render(){  return (<MapboxGL.MapView                  ref={(c) => (this._map = c)}                  style={{ flex: 1 }}                  rotateEnabled={false}                  logoEnabled={false}                  userTrackingMode={1}                  pitchEnabled={false}>                  {this.getAnnotations()}<MapboxGL.Camera                    zoomLevel={1.1}                    followUserLocation={false}                    centerCoordinate={[9, 34]}                  /></MapboxGL.MapView>);  }}

now , defaut annotations ( annotations1 ) is showing well , but when i press on one filter button , no map changing , it keeps default annotations and this is my problem , i want to chnage setted annotations by news assigned annotaions returned by getAnnotaions() every

setState()

and

forceUpdate()

call (the both are not working ) , please i need help with this problem , and thanks for all.

Android key signing on Windows for React Expo app?

$
0
0

I'm currently following this tutorial (https://medium.com/@inaguirre/react-native-login-with-google-quick-guide-fe351e464752) to add "Login with Google." I got the OAuth client ID working for iOS, but for Android, it requires an SHA-1 certificate fingerprint.
enter image description here

I tried:

openssl rand -base64 32 | openssl sha1 -c  

and (I replaced the "path-to-debug-or-production-keystore" with the full file path)

keytool -keystore path-to-debug-or-production-keystore -list -v   

but neither of these work. A lot of advices given online is from the context of using Android Studio, but I'm using VS Code for an Expo app.

I get this error when I run the second, keytool command in the Command Prompt & PowerShell.

keytool error: java.lang.Exception: Keystore file exists, but is empty: C:\Users\User\Desktop\appjava.lang.Exception: Keystore file exists, but is empty: C:\Users\User\Desktop\app        at sun.security.tools.keytool.Main.doCommands(Unknown Source)        at sun.security.tools.keytool.Main.run(Unknown Source)        at sun.security.tools.keytool.Main.main(Unknown Source)

I also tried running

keytool -keystore path-to-debug-or-production-keystore -list -v   

within the folder that contains the keytool.exe file within the Program Files/Java/jre1.8.0_241 folder, but same error.

Any help?
Thanks

React Native Expo Framework, WebView unable to load URL, got error ERR_CACHE_MISS

$
0
0

I'm currently developing a mobile app using expo framework (the client is specifically asking me to use expo framework), and I use WebView to display web page (one of the requirement from client).The problem right now is I cannot run WebView successfully in my android device, while in iOS it worked without any problem.

Please find below the following detail:

How to reproduce the issue:

  1. Install a blank project of expo. I got the instruction from https://docs.expo.io/
  2. Once done, I replace the App.js code with WebView example from https://docs.expo.io/versions/latest/sdk/webview/
  3. I ran the application by executing "npm run start"
  4. Open the application through expo app in my android device (please see above for the detail of my android device)
  5. I got the following error:
Error loading pageDomain: undefinedError code: -1Description: net::ERR_CACHE_MISS

Please help to resolve the issue.

Thank you very much


how to store/save data in react native

$
0
0

How to store/save data in react native.Like we use shared-preference in android is there any solution for react native.I am new to react-nactive.

please add sample example

PlayStore publishing from two different persons

$
0
0

I am managing a mobile application that was first published by another person and I was on my way to release the first update on my own but I couldn't.

  • Used technology : react-native
  • What I did:
  1. Followed official react-native doc on how to publish (create keystore, configuring project accordingly, generating aab, uploading it to Google Console)
  2. When I uploaded my .aab file, I got the following error
Upload failedYour Android App Bundle is signed with the wrong key. Ensure that your App Bundle is signed with the correct signing key and try again: SHA1: *SHA1 Key*
  1. I understood that there is a key problem but I couldn't know what would solve it, I tried downloading the keys provided in the Google Console but that also was a dead-end !

What can I do ? Can someone explain how can two developers (or more) manage the releases of the same application ?

Cannot run android in react native

$
0
0

This is my first time running react native Andriod code, IOS code runs fine, but when I try to run android code, I got this error, what do you suggest I should do?

$ yarn run androidyarn run v1.22.4$ react-native run-androidwarn The following packages use deprecated "rnpm" config that will stop working from next release:

FAILURE: Build failed with an exception.

  • What went wrong:Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.Could not find com.mg.RxCustomizedImagePicker:fileprovider:1.0.0.Searched in the following locations:- file:/Users/XXXlaptop/.m2/repository/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom- file:/Users/XXXlaptop/.m2/repository/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar- file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/react-native/android/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom- file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/react-native/android/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar- file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/jsc-android/dist/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom- file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/jsc-android/dist/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar

How to add custom font in react native android

$
0
0

I am learning react-native, trying to create some demo apps just for learning. I want to set fontFamily to roboto thin of my toolbar title.

I have added roboto thin ttf in assets/fonts folder of my android project, however it seems that it is creating issues while running app. I am getting this issue while running

react-native start

ERROR  EPERM: operation not permitted, lstat 'E:\Myntra\android\app\build\generated\source\r\debug\android\support\v7\appcompat'{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"E:\\Myntra\\android\\app\\build\\generated\\source\\r\\debug\\android\\support\\v7\\appcompat"}Error: EPERM: operation not permitted, lstat 'E:\Myntra\android\app\build\generated\source\r\debug\android\support\v7\appcompat'    at Error (native)

When I am removing the font then it is working fine.I am unable to fix this issue, can anyone help me what can be the reason for this.

Thanks in advance.

Error: Unable to determine the current character, it is not a string, number, array, or object in react-native for android

$
0
0

Whenever I run react-native run-android while keeping the emulator running, I get this error. react-native run-ios wroks completely fine.

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081:ReactNative:Failed to parse React Native CLI configuration: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or objectThe current character read is 'E' with an int value of 69Unable to determine the current character, it is not a string, number, array, or objectline number 1index number 0Error: Invalid attribute nameLine: 16Column: 18Char: .    at error (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/sax/lib/sax.js:651:10)    at strictFail (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/sax/lib/sax.js:677:7)    at SAXParser.write (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/sax/lib/sax.js:1313:13)    at new XmlDocument (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/xmldoc/lib/xmldoc.js:261:15)    at readManifest (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/@react-native-community/cli-platform-android/build/config/readManifest.js:38:10)    at Object.projectConfig (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/@react-native-community/cli-platform-android/build/config/index.js:59:46)    at Object.get project [as project] (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/config/index.js:114:50)    at /Users/yashatreya/Desktop/Realyze/Realyze/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:8:452    at Array.forEach (<anonymous>)    at _objectSpread (/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:8:392)^FAILURE: Build failed with an exception.* Where:Script '/Users/yashatreya/Desktop/Realyze/Realyze/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 201* What went wrong:A problem occurred evaluating script.> Failed to parse React Native CLI configuration. Expected running 'npx --quiet --no-install react-native config' command from '/Users/yashatreya/Desktop/Realyze/Realyze' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again* 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

As indicated in the error message, I tried running npm uninstall -g react-native react-native-cli but it didn’t work.

Info about my environment:

System:    OS: macOS 10.15    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz    Memory: 29.68 MB / 8.00 GB    Shell: 3.2.57 - /bin/bash  Binaries:    Node: 12.13.0 - /usr/local/bin/node    Yarn: 1.19.1 - /usr/local/bin/yarn    npm: 6.12.0 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  SDKs:    iOS SDK:      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0  IDEs:    Android Studio: 3.5 AI-191.8026.42.35.5977832    Xcode: 11.0/11A420a - /usr/bin/xcodebuild  npmPackages:    react: 16.9.0 => 16.9.0     react-native: ^0.61.4 => 0.61.4   npmGlobalPackages:    react-native-cli: 2.0.1

android/app/build.gradle below:

apply plugin: "com.android.application"import com.android.build.OutputFileproject.ext.react = [    entryFile: "index.js",    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"def enableSeparateBuildPerCPUArchitecture = falsedef enableProguardInReleaseBuilds = falsedef jscFlavor = 'org.webkit:android-jsc:+'def enableHermes = project.ext.react.get("enableHermes", false);android {    compileSdkVersion rootProject.ext.compileSdkVersion    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    defaultConfig {        applicationId "com.realyze"        minSdkVersion 21         targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 1        versionName "1.0"        multiDexEnabled true    }    // rootProject.ext.minSdkVersion    splits {        abi {            reset()            enable enableSeparateBuildPerCPUArchitecture            universalApk false  // If true, also generate a universal APK            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"        }    }    signingConfigs {        debug {            storeFile file('debug.keystore')            storePassword 'android'            keyAlias 'androiddebugkey'            keyPassword 'android'        }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        release {            // Caution! In production, you need to generate your own keystore file.            // see https://facebook.github.io/react-native/docs/signed-apk-android.            signingConfig signingConfigs.debug            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"        }    }    // applicationVariants are e.g. debug, release    applicationVariants.all { variant ->        variant.outputs.each { output ->            // For each separate APK per architecture, set a unique version code as described here:            // https://developer.android.com/studio/build/configure-apk-splits.html            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]            def abi = output.getFilter(OutputFile.ABI)            if (abi != null) {  // null for the universal-debug, universal-release variants                output.versionCodeOverride =                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode            }        }    }}dependencies {    implementation project(':react-native-push-notification')    implementation project(':react-native-sound')    implementation project(':react-native-audio')    implementation 'com.android.support:multidex:2.0.1'    implementation project(':react-native-gesture-handler')    implementation fileTree(dir: "libs", include: ["*.jar"])    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'    implementation 'com.google.firebase:firebase-analytics:17.2.0'    implementation 'com.google.firebase:firebase-auth:19.1.0'    implementation project(path: ":@react-native-firebase_auth")    implementation project(path: ":@react-native-firebase_messaging")    implementation project(path: ":@react-native-firebase_database")    implementation project(':react-native-datetimepicker')    implementation project(path: ":@react-native-firebase_firestore")    implementation project(path: ":@react-native-firebase_functions")}    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } else {        implementation jscFlavor    }// }// Run this once to be able to run the application with BUCK// puts all compile dependencies into folder libs for BUCK to usetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)apply plugin: 'com.google.gms.google-services'

android/build.gradle below :

buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 16        compileSdkVersion = 28        targetSdkVersion = 28    }    repositories {        google()        jcenter()    }    dependencies {        classpath "com.android.tools.build:gradle:3.4.2"        classpath 'com.google.gms:google-services:4.3.2'    }}allprojects {    repositories {        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()        jcenter()        maven { url 'https://jitpack.io' }    }}

Initially I was getting this error: react-native build error: Could not find method implementation() for arguments [jscFlavor] on project ':app' of type org.gradle.api.Project but now I am getting the above.

Cannot run android in react native due to "Could not find com.mg.RxCustomizedImagePicker:fileprovider:1.0.0"

$
0
0

This is my first time running react native Andriod code, IOS code runs fine, but when I try to run android code, I got this error, what do you suggest I should do?

$ react-native run-androidyarn run v1.22.4$ react-native run-androidwarn The following packages use deprecated "rnpm" config that will stop working from next release:  - native-base: https://github.com/GeekyAnts/NativeBase#readmePlease notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 1113 file(s) to forward-jetify. Using 12 workers...info JS server already running.info Installing the app...FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:preDebugBuild'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not find com.mg.RxCustomizedImagePicker:fileprovider:1.0.0.     Searched in the following locations:       - file:/Users/XXXlaptop/.m2/repository/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom       - file:/Users/XXXlaptop/.m2/repository/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar       - file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/react-native/android/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom       - file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/react-native/android/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar       - file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/jsc-android/dist/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.pom       - file:/Users/XXXlaptop/Documents/Code/uf-mobile/node_modules/jsc-android/dist/com/mg/RxCustomizedImagePicker/fileprovider/1.0.0/fileprovider-1.0.0.jar

How to redirect an user to another app using react native on android

$
0
0

The code bellow is supposed to send an user to the mercado pago app, it is working well on IOS, but it is not working on android, I have the app installed and I do not understand why it is happening, can you help me?

The error I am getting is:

Could not open URL 'intent://mercadopago://app#Intent;scheme=mercadopago;package=com.mercadopago;end': No Activity found to handle Intent { act=android.intent.action.VIEW dat=intent://mercadopago://app flg=0x10000000 }

<Card          style={styles.card}          onPress={() => {            if (Platform.OS === "ios") {              Linking.openURL("mercadopago://app").catch((err) => {                Linking.openURL("https://apps.apple.com/br/app/mercado-pago/id925436649"                );              });            } else {              Linking.openURL("mercadopago://app").catch((err) => {                console.log(err)                Linking.openURL("https://play.google.com/store/apps/details?id=com.mercadopago.wallet&hl=pt_BR"                );              });            }          }}>

Can't find C:\Android\tools\bin\platform-tools

$
0
0

I'm trying to install react native on windows and I'm following this guide https://reactnative.dev/docs/environment-setup (you have to select "React Native CLI Quickstart" then "Windows" as Development OS and "Android" as Target OS)

I have done everything but I can't seem to find the platform file at C:\Android\tools\bin\platform-tools (4th point of the guide)

the bin folder: https://imgur.com/a/daqBSM0

React native error,canOverrideExistingModule=true

$
0
0

Hi I try 3 libaries(react native -(sound,sound player,play sound) to play sound but I can not play a sound onPress Togglebutton

It gives this error

The error

App.js

import React, { useState } from 'react';import {  View,  Text,  FlatList,  SafeAreaView,  TouchableOpacity,  ImageBackground} from 'react-native';import { PlaySound, StopSound, PlaySoundRepeat, PlaySoundMusicVolume } from 'react-native-play-sound';//FFE990       FFD488     FFE493    E7CE85   E7C287const ToggleButton = (props) => {  const [isPressed, setIsPressed] = useState(false);  const { sample, id, onPress, item1, item2 } = props;  const text = isPressed ? item2.sample2 : item1.sample;  return (<TouchableOpacity      onPress={() => {        setIsPressed(!isPressed);        onPress && onPress();        PlaySound('./john.mp3');      }}      style={{ flex: 1 }}><View        style={{          flex: 1,          width: '100%',          height: 129,          backgroundColor:'#E7C287',          borderWidth: 1,          marginTop:36,          justifyContent: 'center',          alignItems: 'center',          padding:8        }}><Text style={{   fontSize: 14 }}>{text}</Text></View></TouchableOpacity>  );};const ToggleExample = () => {  const data = [    {sample:"Mouse",id:"0"},    {sample:"Mouse2",id:"1"},    ,   , ];  const data2 = [    {sample2:"Disney",id:"0"},{sample2:"Sindirella",id:"1"},];  return (<ImageBackground source={require('./assets/papi2.jpg')}  style={{      flex: 1,      width:'100%',      height:'100%'    }}> <SafeAreaView style={{ flex: 1 ,alignItems: 'center',}}><Text style={{marginTop:21,    padding:16,    marginBottom:27,    fontSize:28,    alignItems: 'center',    }}>Post</Text><FlatList        data={data}        renderItem={(entry) => {          const { item } = entry;          return (<ToggleButton              item1={item}              item2={data2.filter((_item) => _item.id === item.id)[0]}            />          );        }}        contentContainerStyle={{ padding: 20 }}        ItemSeparatorComponent={() => {          return <View style={{ flex: 1, height: 10 }} />;        }}        keyExtractor={(entry, index) => index.toString()}      /></SafeAreaView></ImageBackground>  );};export default ToggleExample;

That's my code on press I try to play "john.mp3" but now it says

"canOverrideExistingModule=true" in the Main activity. I searched, tried to override this func but it still says same

"Native module SoundManager tried to override,Check getPackages() ..."

MainApp.java

package com.post42;import android.app.Application;import android.content.Context;import com.facebook.react.PackageList;import com.facebook.react.ReactApplication;import com.soundapp.SoundModulePackage;import com.facebook.react.ReactInstanceManager;import com.facebook.react.ReactNativeHost;import com.facebook.react.ReactPackage;import com.facebook.soloader.SoLoader;import java.lang.reflect.InvocationTargetException;import java.util.List;public class MainApplication extends Application implements ReactApplication {  private final ReactNativeHost mReactNativeHost =      new ReactNativeHost(this) {        @Override        public boolean getUseDeveloperSupport() {          return BuildConfig.DEBUG;        }        @Override        protected List<ReactPackage> getPackages() {          @SuppressWarnings("UnnecessaryLocalVariable")          List<ReactPackage> packages = new PackageList(this).getPackages();          // Packages that cannot be autolinked yet can be added manually here, for example:          // packages.add(new MyReactNativePackage());          return packages;        }        @Override        protected String getJSMainModuleName() {          return "index";        }      };  @Override  public ReactNativeHost getReactNativeHost() {    return mReactNativeHost;  }  @Override  public void onCreate() {    super.onCreate();    SoLoader.init(this, /* native exopackage */ false);    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());  }  /**   * Loads Flipper in React Native templates. Call this in the onCreate method with something like   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());   *   * @param context   * @param reactInstanceManager   */  private static void initializeFlipper(      Context context, ReactInstanceManager reactInstanceManager) {    if (BuildConfig.DEBUG) {      try {        /*         We use reflection here to pick up the class that initializes Flipper,        since Flipper library is not available in release mode        */        Class<?> aClass = Class.forName("com.post42.ReactNativeFlipper");        aClass            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)            .invoke(null, context, reactInstanceManager);      } catch (ClassNotFoundException e) {        e.printStackTrace();      } catch (NoSuchMethodException e) {        e.printStackTrace();      } catch (IllegalAccessException e) {        e.printStackTrace();      } catch (InvocationTargetException e) {        e.printStackTrace();      }    }  }}

How can I fix it.Thank you

I still can't fix it

Fetch request iin react native getting null parameters data from server in react native

$
0
0

I am trying to call from fetch request but I am passing parameters on request is fine but when I checked server-side getting null data I am unable to understand whats exact problem after I research i found that charset=utf-8 need to mention so I did still having the same issue.

 const request = {            videoId: data.videoId,            comments: data.comments,            views: parseInt(data.views) + 1,            likes: data.likes,            shares: data.shares        }        alert(JSON.stringify(request));        fetch(URL +'/VideosController/updateVideo', {            method: 'POST', // or 'PUT'            headers: {'Accept': 'application/json','content-Type': "application/json; charset=utf-8" // "text/html; charset=UTF-8",            },            body: JSON.stringify(request),        })            .then(response => response.json())            .then((postsJson) => {                alert('res1 +'+ JSON.stringify(postsJson));            })            .catch((error) => {                alert('Error:', JSON.stringify(error));            });

Undefined is not an object (evaluating '_PushTokenManager.default.getDevicePushTokenAsync [REACT NATIVE EXPO]

$
0
0

Can't get the token with the getExpoPushTokenAsync() function on expo-notifications api.The function as follow is just identical to Expo documentation:

import Constants from "expo-constants";import * as Notifications from "expo-notifications";import * as Permissions from "expo-permissions";    async function registerForPushNotificationsAsync() {      let token;      if (Constants.isDevice) {        const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);        let finalStatus = existingStatus;        if (existingStatus !== 'granted') {          const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);          finalStatus = status;        }        if (finalStatus !== 'granted') {          alert('Failed to get push token for push notification!');          return;        }        token = (await Notifications.getExpoPushTokenAsync()).data;        console.log(token);      } else {        alert('Must use physical device for Push Notifications');      }      if (Platform.OS === 'android') {        Notifications.setNotificationChannelAsync('default', {          name: 'default',          importance: Notifications.AndroidImportance.MAX,          vibrationPattern: [0, 250, 250, 250],          lightColor: '#FF231F7C',        });      }      return token;    }

Expo: ~37.0.3App.json:

"expo": {"android": {"useNextNotificationsApi": true}}

Seems like when calling the function, got the next warning:

[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_PushTokenManager.default.getDevicePushTokenAsync')]

Anyone know about this?

Google Admob ads not showing

$
0
0

I just create an android app and ios app and want to integrate ads from my google AdMob account. but Ads do not show up.But when I test my app from the developer's guidance as they provide sample id's for interstitial ads and also for app id the app work fine but as soon as I put interstitial ads id and app id from my Admob account then the problem occurred.For the first time when I upload my add to the app store and google play store then approx 1 week ads is working then after suddenly stop working.

Please anyone has an idea. Please let me know how to solve this problem?

Viewing all 28490 articles
Browse latest View live


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