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

camera.takePictureAsync(options) is not a function in react native camera

$
0
0

Hello im new in react native and i just building my first react native project with camera without expo. I installed it with npm install react-native-camera and then linked it with react-native link react-native-camera. The camera run successfuly, but when i triggered the snap button it got error like this....

{ [TypeError: camera.takePictureAsync is not a function. (In 'camera.takePictureAsync(options)', 'camera.takePictureAsync' is undefined)] │ line: 131480, │ column: 72, └ sourceURL: 'http://localhost:8081/index.bundle?platform=android&dev=true&minify=false' }

Here is my code looks like...

import React, { useRef } from 'react'
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'
import { RNCamera } from 'react-native-camera'


function PlayWithCamera() {

    const camera = useRef(null)

    const takePicture = async () => {
        try {
            const options = { quality: 0.5, base64: true };
            const data = await camera.takePictureAsync(options);
            console.log(data.uri, '<<<<<<<<<<<<<<<<<<<<<');
        } catch (error) {
            console.log(error, "ERROR <<<<<<<<<<<<<")
        }
    };

    return (
        <View style={styles.container}><RNCamera
                ref={camera}
                style={styles.preview}
                type={RNCamera.Constants.Type.back}
                flashMode={RNCamera.Constants.FlashMode.on}
                androidCameraPermissionOptions={{
                    title: 'Permission to use camera',
                    message: 'We need your permission to use your camera',
                    buttonPositive: 'Ok',
                    buttonNegative: 'Cancel'
                }}
                androidRecordAudioPermissionOptions={{
                    title: 'Permission to use audio recording',
                    message: 'We need your permission to use your audio',
                    buttonPositive: 'Ok',
                    buttonNegative: 'Cancel',
                }}
                onGoogleVisionBarcodesDetected={({ barcodes }) => {
                    console.log(barcodes)
                }}
            /><View style={{ flex: 1, width: '100%', flexDirection: 'row', justifyContent: 'center', position: 'absolute', bottom: 0 }}><TouchableOpacity style={styles.capture} onPress={takePicture}><Text style={{ fontSize: 14 }}> SNAP </Text></TouchableOpacity></View></View>
    )
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        flexDirection: 'column',
        backgroundColor: 'black',
    },
    preview: {
        flex: 1,
        justifyContent: 'flex-end',
        alignItems: 'center',
    },
    capture: {
        flex: 0,
        backgroundColor: '#fff',
        borderRadius: 5,
        padding: 15,
        paddingHorizontal: 20,
        alignSelf: 'center',
        margin: 20,
    },
})

export default PlayWithCamera

UPDATE (18.48): I tried using class component like in react-native-camera documentation did, and it finally works. But i still curious how to make it works in function component?


which technology digital banks use to transfer money [closed]

$
0
0

I am developing an app for instant money transfer between customer from different banks, so I wanted to know what technology is used and what security methods too! An example would be Revolut, how does it work?

react-native run-android is unrecognized

$
0
0

I've installed react-native-cli globally:

npm install -g react-native-cli

Then run:

react-native init AwesomeProject
cd AwesomeProject

I got the following structure:

-- AwesomeProject   
---- node_modules      
------ react-native    

When I run react-native run-android I get an error:
Command run-android unrecognized. Did you mean to run this inside a react-native project?

When I run react-native start I get the same.

react-native -v
prints:
react-native-cli: 0.2.0
react-native: n/a - not inside a React Native project directory

What I'm doing wrong?

React Native geolcation number of satterlites

React Native build fails giving following error

$
0
0

command->' lerna exec --scope=recruiter -- yarn android ' error-> Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

  • What went wrong: Cannot create service of type TaskExecuter using ProjectExecutionServices.createTaskExecuter() as there is a problem with parameter #21 of type ReservedFileSystemLocationRegistry.

    Cannot create service of type ReservedFileSystemLocationRegistry using ProjectExecutionServices.createReservedFileLocationRegistry() as there is a problem with parameter #1 of type List.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2m 29s

OS- Linux

Video cannot close from fullscreen in react-native webview (ios)

$
0
0

I am using react-native-community/react-native-webview and on the website we have Nexx player for playing videos.

Android works fine but I have problems with ios. On ios, I have a fullscreen modal where is possible to play video. And if I click on play button video jump into fullscreen mode and start playing. That is right. But if I want to close video by X button on the corner Video will jump back to start position and immediately jump back to the fullscreen mode and sometimes show an icon over the video. I will try to close it and the situation will be repeating after a few repeating is finally closed.

enter image description here

I think the problem is in ios fullscreen video player. Because if I want to play video some fancy webview features will handle video and show it in fullscreen (because Nexx player looks different then this view and I also tried to turn off fullscreen mode but video always jumps in fullscreen). I try to pause the video when it will jump out of fullscreen but it doesn't work. (It works when I pause the video first in fullscreen mode and then I will click on close button = video is close right but if I click on a close button it is doesn't work)

Is there some way how to fix this issues? Or How to control webview feature pause it and then close it when the user clicks on X button?

How to set orientation to portrait mode, regardless the auto-rotate in Android / React Native

$
0
0

I want to set portrait mode in my react native android application, I tried to

  1. set android:screenOrientation="portrait" in my Android Manifest.xml file,
  2. adding orientation programmatically in my activity as setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); but none of these is working.

Note: I have added react-native-navigation in my project

Any inputs to resolve this? Thanks.

React-Native: "FirebaseError: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app)"

$
0
0

I'm building a React Native app, currently trying to implement an authentication registration system through Firebase Auth. I've followed a guide/the docs on the website to setup the Firebase config file. I run the app, enter a email and password, when I click the signup button I'm given the follow error below:

FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).

I've search on google for possible fixes yet nothing seems to work. I've initialized Firebase as per the docs/tutorials I've watched. Hopefully someone can shed some light on the matter. I'll include the config file code below, XXXX to replace my actual config info

firebase.js

import * as firebase from 'firebase/app';
import "firebase/auth";

const firebaseConfig = {
  apiKey: "XXXX",
  authDomain: "XXXX",
  databaseURL: "XXXX",
  projectId: "XXXX",
  storageBucket: "XXXX",
  messagingSenderId: "XXXX",
  appId: "XXXX",
  measurementId: "XXXX"
};

firebase.initializeApp(firebaseConfig);

api.js

export function registerUser({email, password}) {
  firebase
    .auth()
    .createUserWithEmailAndPassword(email, password)
    .catch(function(error) {
      console.log(error);
    });
};

EDIT/ANSWER

As helped in the comments below, the correct way was to implement/import through React-Native-Firebase. Links are in the comments.


i am not show Component code in react-native text component

$
0
0

I can't show Component code in react-native text component

I have created button component for my app.Here is my code

>     <TouchableOpacity>
>      <Text>Button</Text>
>     </TouchableOpacity>

how to show this code in Text?

Please Help me for this issue.

How to adjust font size to fit view in React Native for Android?

$
0
0

How I can make the font size of the text auto change inside a view in react native?

I have text with different lengths, some of which doesn't fit the view so decreased the font size. I have checked the docs and found this but it's for iOS only and I need it for Android.

And does it work with other components like button and touchableopacity?

Change TextInput Style on Focus React Native Paper

$
0
0

First of all, I've researched through other posts and find many solutions but nothing work in React Native Paper ?

I need change TextInput Style on Focus in React Native Paper

Finding the cause of React Native Android App Crash

$
0
0

After spending many hours of tracing, I am unable to find the issue for the crash of React Native Android App. A white screen appears after react-native run-android and then suddenly the message displays MyApp has stopped! The App was previously working fine! Maybe the Android Studio updates have caused the issue! After doing adb logcat, here is the output! (Sorry for the detailed output).

12-10 09:10:00.586  1413  1413 I boot-pipe: done populating /dev/random
12-10 09:10:04.801  2603  2603 I MicroDetectionWorker: #updateMicroDetector [detectionMode: [mDetectionMode: [1]]]
12-10 09:10:04.801  2603  2603 I MicroDetectionWorker: #startMicroDetector [speakerMode: 0]
12-10 09:10:04.802  2603  2603 I AudioController: Using mInputStreamFactoryBuilder
12-10 09:10:04.803  2603  2603 I MicroDetectionWorker: onReady
12-10 09:10:04.806  2603  2716 I MicroRecognitionRunner: Starting detection.
12-10 09:10:04.806  2603  2680 I MicrophoneInputStream: mic_starting com.google.android.apps.gsa.staticplugins.aa.c@427c2af
12-10 09:10:04.806  1499  1594 W ServiceManager: Permission failure: android.permission.RECORD_AUDIO from uid=10032 pid=2603
12-10 09:10:04.806  1499  1594 E         : Request requires android.permission.RECORD_AUDIO
12-10 09:10:04.806  1499  1594 E         : android.permission.CAPTURE_AUDIO_HOTWORD
12-10 09:10:04.806  2603  2680 E AudioRecord: Could not get audio input for session 281, record source 1999, sample rate 16000, format 0x1, channel mask 0x10, flags 0
12-10 09:10:04.807  2603  2680 E AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -22.
12-10 09:10:04.807  2603  2680 E android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
12-10 09:10:04.807  2603  2680 I MicrophoneInputStream: mic_started com.google.android.apps.gsa.staticplugins.aa.c@427c2af
12-10 09:10:04.812  2603  2680 I MicrophoneInputStream: mic_close com.google.android.apps.gsa.staticplugins.aa.c@427c2af
12-10 09:10:04.813  2603  2716 I MicroRecognitionRunner: Detection finished
12-10 09:10:04.813  2603  2716 W ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
12-10 09:10:04.813  2603  2908 I MicroRecognitionRunner: Stopping hotword detection.
12-10 09:10:04.813  2603  2716 W ErrorProcessor: onFatalError, processing error from engine(4)
12-10 09:10:04.813  2603  2716 W ErrorProcessor: com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.staticplugins.recognizer.j.a.a(SourceFile:28)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.staticplugins.recognizer.j.b.run(SourceFile:15)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.shared.util.concurrent.a.ag.run(Unknown Source:4)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.lang.Thread.run(Thread.java:764)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:6)
12-10 09:10:04.813  2603  2716 W ErrorProcessor: Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.speech.audio.Tee.f(SourceFile:103)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at java.io.InputStream.read(InputStream.java:101)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:18)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2)
12-10 09:10:04.813  2603  2716 W ErrorProcessor:    ... 11 more
12-10 09:10:04.813  2603  2716 I AudioController: internalShutdown
12-10 09:10:04.814  2603  2603 I MicroDetectionWorker: onReady
12-10 09:10:04.838  2603  2603 I MicroDetector: Keeping mic open: false
12-10 09:10:04.838  2603  2603 I MicroDetectionWorker: #onError(false)
12-10 09:10:04.839  2603  2721 I DeviceStateChecker: DeviceStateChecker cancelled
12-10 09:10:04.807  2603  2680 E ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
12-10 09:10:08.228  1626  1643 E BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
12-10 09:10:29.990  2603  2716 I AudioController: internalShutdown
12-10 09:10:30.005  2603  2603 I MicroDetectionWorker: onReady
12-10 09:10:30.005  2603  2603 I MicroDetector: Keeping mic open: false
12-10 09:10:30.005  2603  2603 I MicroDetectionWorker: #onError(false)
12-10 09:10:30.005  2603  2721 I DeviceStateChecker: DeviceStateChecker cancelled
12-10 09:10:30.581  4961  4961 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
12-10 09:10:30.588  4961  4961 W app_process: Could not reserve sentinel fault page
12-10 09:10:30.767  4961  4961 W app_process: Unexpected CPU variant for X86 using defaults: x86
12-10 09:10:30.769  4961  4961 I app_process: The ClassLoaderContext is a special shared library.
12-10 09:10:30.806  4961  4961 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
12-10 09:10:30.812  4973  4973 E asset   : setgid: Operation not permitted
12-10 09:10:31.343  1626  1652 W PackageParser: Unknown element under <manifest>: meta-data at /data/app/vmdl1727045792.tmp/base.apk Binary XML file line #18
12-10 09:10:31.357  1626  1652 I PackageManager.DexOptimizer: Running dexopt (dexoptNeeded=1) on: /data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ==/base.apk pkg=com.myapp isa=x86 dexoptFlags=boot_complete,debuggable,public target-filter=quicken oatDir=/data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ==/oat sharedLibraries=PCL[]
12-10 09:10:31.369  4976  4976 W dex2oat : Unexpected CPU variant for X86 using defaults: x86
12-10 09:10:31.369  4976  4976 W dex2oat : Mismatch between dex2oat instruction set features (ISA: X86 Feature string: -ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) and those of dex2oat executable (ISA: X86 Feature string: ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) for the command line:
12-10 09:10:31.369  4976  4976 W dex2oat : /system/bin/dex2oat --zip-fd=8 --zip-location=base.apk --input-vdex-fd=-1 --output-vdex-fd=10 --oat-fd=9 --oat-location=/data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ==/oat/x86/base.odex --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=quicken --swap-fd=11 --debuggable --classpath-dir=/data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ== --class-loader-context=PCL[]
12-10 09:10:31.369  4976  4976 I dex2oat : /system/bin/dex2oat --input-vdex-fd=-1 --output-vdex-fd=10 --compiler-filter=quicken --debuggable --classpath-dir=/data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ== --class-loader-context=PCL[]
12-10 09:10:31.371  4976  4976 W dex2oat : Could not reserve sentinel fault page
12-10 09:10:32.007  4976  4976 I dex2oat : dex2oat took 638.634ms (964.409ms cpu) (threads: 2) arena alloc=62KB (63776B) java alloc=4MB (5018336B) native alloc=5MB (5892024B) free=2MB (3020872B)
12-10 09:10:32.011  1626  1640 I ActivityManager: Force stopping com.myapp appid=10080 user=-1: installPackageLI
12-10 09:10:32.162  1502  2099 E         : Couldn't opendir /data/app/vmdl1727045792.tmp: No such file or directory
12-10 09:10:32.162  1502  2099 E installd: Failed to delete /data/app/vmdl1727045792.tmp: No such file or directory
12-10 09:10:32.163  1626  1652 I ActivityManager: Force stopping com.myapp appid=10080 user=0: pkg removed
12-10 09:10:32.163  4961  4961 I Pm      : Package com.myapp installed in 1355 ms
12-10 09:10:32.179  4961  4961 I app_process: System.exit called, status: 0
12-10 09:10:32.179  4961  4961 I AndroidRuntime: VM exiting with result code 0.
12-10 09:10:32.184  1626  1683 I InputReader: Reconfiguring input devices.  changes=0x00000010
12-10 09:10:32.188  1626  1683 I chatty  : uid=1000(system) InputReader identical 1 line
12-10 09:10:32.192  1626  1683 I InputReader: Reconfiguring input devices.  changes=0x00000010
12-10 09:10:32.206  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.214  2691  2691 I chatty  : uid=10024(com.android.vending) identical 3 lines
12-10 09:10:32.215  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.221  2117  4693 E NetworkScheduler.SR: Unrecognised action provided: android.intent.action.PACKAGE_REMOVED
12-10 09:10:32.235  1626  2293 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
12-10 09:10:32.244  1827  1827 D CarrierSvcBindHelper: No carrier app for: 0
12-10 09:10:32.247  1626  1626 I Telecom : DefaultDialerCache: Refreshing default dialer for user 0: now com.google.android.dialer: DDC.oR@AKc
12-10 09:10:32.256  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.256  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.260  2691  3046 W WearSignatureVerifier: No package com.google.android.wearable.app.cn
12-10 09:10:32.261  2691  3046 I chatty  : uid=10024(com.android.vending) GAC_Executor[1] identical 2 lines
12-10 09:10:32.261  2691  3046 W WearSignatureVerifier: No package com.google.android.wearable.app.cn
12-10 09:10:32.267  2691  2691 I Finsky  : [2] com.google.android.finsky.utils.PermissionPolicies$PermissionPolicyService.onStartCommand(18): post-install permissions check for com.myapp
12-10 09:10:32.267  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.267  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.270  1827  1827 D CarrierSvcBindHelper: No carrier app for: 0
12-10 09:10:32.273  2691  2691 I Finsky  : [2] com.google.android.finsky.externalreferrer.d.run(9): Package state data is missing for com.myapp
12-10 09:10:32.274  2117  2117 I WearableService: Wearable Services not starting - Wear is not available on this device.
12-10 09:10:32.281  2691  2691 W Finsky  : [2] com.google.android.finsky.application.FinskyAppImpl.bx(1166): No account configured on this device.
12-10 09:10:32.294  1827  1827 D ImsResolver: maybeAddedImsService, packageName: com.myapp
12-10 09:10:32.294  1827  1827 D CarrierConfigLoader: mHandler: 9 phoneId: 0
12-10 09:10:32.298  2205  2215 I zygote  : Background concurrent copying GC freed 6722(457KB) AllocSpace objects, 7(520KB) LOS objects, 49% free, 3MB/6MB, paused 68us total 112.528ms
12-10 09:10:32.301  2117  2380 D WearableService: onGetService - Wear is not available on this device.
12-10 09:10:32.302  2691  2691 W WearSignatureVerifier: No package com.google.android.wearable.app.cn
12-10 09:10:32.302  2691  2691 E Finsky  : [2] com.google.android.finsky.wear.bl.a(3): onConnectionFailed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
12-10 09:10:32.302  2691  2691 W Finsky  : [2] com.google.android.finsky.wear.aj.run(9): Dropping command=auto_install due to Gms not connected
12-10 09:10:32.311  1626  1636 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
12-10 09:10:32.312  1626  1640 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.apps.photos/.account.full.FetchAccountPropertiesAppUpgradeBroadcastReceiver
12-10 09:10:32.312  1626  1640 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.apps.photos/.backgroundsignin.BackgroundSignInBroadcastReceiver
12-10 09:10:32.312  1626  1640 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.apps.photos/.experiments.phenotype.full.PhenotypeAppUpgradeBroadcastReceiver
12-10 09:10:32.312  1626  1640 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.apps.photos/.notificationchannels.AppUpdateBroadcastReceiver
12-10 09:10:32.324  2368  4992 D Wear_Controller: Received broadcast action=android.intent.action.PACKAGE_REMOVED and uri=com.myapp
12-10 09:10:32.350  1626  1636 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.myapp flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
12-10 09:10:32.396  1743  1762 I zygote  : Background concurrent copying GC freed 13156(654KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4MB/9MB, paused 64us total 201.135ms
12-10 09:10:32.419  2368  4999 D Wear_Controller: Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=com.myapp
12-10 09:10:32.715  1626  2163 I ActivityManager: Start proc 5010:com.myapp/u0a80 for activity com.myapp/.MainActivity
12-10 09:10:32.732  5010  5010 W zygote  : Unexpected CPU variant for X86 using defaults: x86
12-10 09:10:32.735  1405  1444 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
12-10 09:10:32.758  5010  5017 E zygote  : Failed sending reply to debugger: Broken pipe
12-10 09:10:32.758  5010  5017 I zygote  : Debugger is no longer active
12-10 09:10:32.848  5010  5010 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
12-10 09:10:32.849  5010  5010 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
12-10 09:10:32.849  5010  5010 I FirebaseInitProvider: FirebaseApp initialization successful
12-10 09:10:33.071  5010  5010 V fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
12-10 09:10:33.072  5010  5010 V fb-UnpackingSoSource: starting syncer worker
12-10 09:10:33.081  5010  5028 I FA      : App measurement is starting up, version: 12780
12-10 09:10:33.081  5010  5028 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
12-10 09:10:33.081  5010  5028 I FA      : To enable faster debug mode event logging run:
12-10 09:10:33.081  5010  5028 I FA      :   adb shell setprop debug.firebase.analytics.app com.myapp
12-10 09:10:33.195  5010  5028 W GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 11580470
12-10 09:10:33.224  5010  5010 D ReactNative: ReactInstanceManager.createReactContextInBackground()
12-10 09:10:33.224  5010  5010 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
12-10 09:10:33.241  1418  1431 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
12-10 09:10:33.496  5010  5010 E unknown:ReactNative: Unable to display loading message because react activity isn't available
12-10 09:10:33.513  1626  1647 I ActivityManager: Displayed com.myapp/.MainActivity: +807ms
12-10 09:10:33.537  5010  5028 I FA      : This instance being marked as an uploader
12-10 09:10:33.581  2368  2860 I Icing   : Indexing 0FC5A07B286EB89ECAB4195EE20B9EE1AB615B80 from com.google.android.gms
12-10 09:10:33.608  1418  1418 W SurfaceFlinger: couldn't log to binary event log: overflow.
12-10 09:10:33.651  2368  2860 I Icing   : Indexing done 0FC5A07B286EB89ECAB4195EE20B9EE1AB615B80
12-10 09:10:33.686  5010  5028 W GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 11580470
12-10 09:10:33.713  2603  2603 W SearchService: Abort, client detached.
12-10 09:10:33.839  2117  2117 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=null]
12-10 09:10:33.843  2117  5046 I Places  : ?: Couldn't find platform key file.
12-10 09:10:33.866  2117  2117 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=null]
12-10 09:10:33.868  2117  2117 I chatty  : uid=10014 com.google.android.gms.persistent identical 1 line
12-10 09:10:33.870  2117  2117 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=null]
12-10 09:10:34.484  5010  5015 I zygote  : Do partial code cache collection, code=60KB, data=37KB
12-10 09:10:34.484  5010  5015 I zygote  : After code cache collection, code=59KB, data=36KB
12-10 09:10:34.484  5010  5015 I zygote  : Increasing code cache capacity to 256KB
12-10 09:10:34.585  5010  5010 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
12-10 09:10:34.585  5010  5010 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
12-10 09:10:34.585  5010  5010 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
12-10 09:10:34.592  5010  5048 I zygote  : Thread[24,tid=5048,Native,Thread*=0x91290c00,peer=0x12d81bd8,"Thread-3"] recursive attempt to load library "/data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ==/lib/x86/libfb.so"
12-10 09:10:34.592  5010  5048 D ReactNative: ReactInstanceManager.createReactContext()
12-10 09:10:34.596  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
12-10 09:10:34.597  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
12-10 09:10:34.598  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
12-10 09:10:34.598  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
12-10 09:10:34.599  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
12-10 09:10:34.599  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
12-10 09:10:34.600  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
12-10 09:10:34.604  5010  5048 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
12-10 09:10:35.170  5010  5052 W GooglePlayServicesUtil: Google Play services out of date.  Requires 12451000 but found 11580470
12-10 09:10:35.479  1626  1636 I ActivityManager: START u0 {act=android.intent.action.VIEW flg=0x10008000 cmp=com.myapp/com.reactnativenavigation.controllers.NavigationActivity (has extras)} from uid 10080
12-10 09:10:35.541  1405  1444 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
12-10 09:10:35.571  5010  5010 D AndroidRuntime: Shutting down VM
12-10 09:10:35.576  5010  5010 E AndroidRuntime: FATAL EXCEPTION: main
12-10 09:10:35.576  5010  5010 E AndroidRuntime: Process: com.myapp, PID: 5010
12-10 09:10:35.576  5010  5010 E AndroidRuntime: java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.myapp-uNSnIgB5mPdTGWEHkrTdCQ==/base.apk)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(Unknown Source:0)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6494)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
12-10 09:10:35.576  5010  5010 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
12-10 09:10:35.600  1743  1775 W asset   : Asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk is neither a directory nor file (type=1).
12-10 09:10:35.600  1743  1775 E ResourcesManager: failed to add asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk
12-10 09:10:35.600  1743  1775 W PackageManager: Failure retrieving resources for com.myapp
12-10 09:10:35.600  1743  1775 W asset   : Asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk is neither a directory nor file (type=1).
12-10 09:10:35.600  1743  1775 E ResourcesManager: failed to add asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk
12-10 09:10:35.600  1743  1775 W PackageManager: Failure retrieving resources for com.myapp
12-10 09:10:35.601  1743  1775 W asset   : Asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk is neither a directory nor file (type=1).
12-10 09:10:35.601  1743  1775 E ResourcesManager: failed to add asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk
12-10 09:10:35.601  1743  1775 W PackageManager: Failure retrieving resources for com.myapp
12-10 09:10:35.601  1743  1775 W asset   : Asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk is neither a directory nor file (type=1).
12-10 09:10:35.601  1743  1775 E ResourcesManager: failed to add asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk
12-10 09:10:35.601  1743  1775 W PackageManager: Failure retrieving resources for com.myapp
12-10 09:10:35.601  1743  1775 W asset   : Asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk is neither a directory nor file (type=1).
12-10 09:10:35.601  1743  1775 E ResourcesManager: failed to add asset path /data/app/com.myapp-Sr-m6BJSCDuUztbtfBYRoA==/base.apk
12-10 09:10:35.601  1743  1775 W PackageManager: Failure retrieving resources for com.myapp
12-10 09:10:35.603  1626  2291 W ActivityManager:   Force finishing activity com.myapp/com.reactnativenavigation.controllers.NavigationActivity
12-10 09:10:35.607  1626  1641 I ActivityManager: Showing crash dialog for package com.myapp u0
12-10 09:10:35.653  1405  1444 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 3100672
12-10 09:10:35.658  1405  1444 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 3100672
12-10 09:10:35.660  1405  1405 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 3100672
12-10 09:10:35.671  1626  4828 I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
12-10 09:10:35.671  1626  4828 I OpenGLRenderer: Initialized EGL, version 1.4
12-10 09:10:35.671  1626  4828 D OpenGLRenderer: Swap behavior 1
12-10 09:10:35.671  1626  4828 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
12-10 09:10:35.671  1626  4828 D OpenGLRenderer: Swap behavior 0
12-10 09:10:35.673  1626  4828 D EGL_emulation: eglCreateContext: 0x8c1a13e0: maj 3 min 0 rcv 3
12-10 09:10:35.675  1626  4828 D EGL_emulation: eglMakeCurrent: 0x8c1a13e0: ver 3 0 (tinfo 0x91222030)
12-10 09:10:36.106  1626  1640 W ActivityManager: Activity pause timeout for ActivityRecord{1d73abc u0 com.myapp/com.reactnativenavigation.controllers.NavigationActivity t9 f}

The App is not using any microphone, strange there are some errors of Audio and Microphone. Here are the build details:

compileSdkVersion 27
    buildToolsVersion "27.0.3"

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 13
        versionName "1.0.8"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

I am using react-native: 0.53.0, with react-native-navigation: 1.1.375

Upgrade React Native 0.61.5: Android stuck on splash screen

$
0
0

I upgraded React Native to 0.61.5, the iOS and Android parts compile successfully. The iOS app launch also successfully but not the Android app.

The Android app launch and stuck on splash screen with no error so I activated logs adb logcat and I found an error about Flipper:

System.err: java.lang.ClassNotFoundException: com.facebook.flipper.ReactNativeFlipper

After 2 day of try I have no idea how to resolve this issue. I have follow all migration procedure for React Native 0.6+ and all packages. This is where I am:

package.json

"dependencies": {
        "@fortawesome/fontawesome-svg-core": "^1.2.25",
        "@fortawesome/pro-light-svg-icons": "^5.11.2",
        "@fortawesome/pro-solid-svg-icons": "^5.11.2",
        "@fortawesome/react-native-fontawesome": "^0.1.0",
        "@react-native-community/async-storage": "^1.6.3",
        "@react-native-community/netinfo": "^4.6.1",
        "@react-native-firebase/analytics": "^6.1.0",
        "@react-native-firebase/app": "^6.1.0",
        "bugsnag-react-native": "^2.23.2",
        "react": "16.9.0",
        "react-native": "0.61.5",
        "react-native-config": "^0.11.7",
        "react-native-dark-mode": "^0.2.1",
        "react-native-datepicker": "^1.7.2",
        "react-native-device-info": "^5.3.1",
        "react-native-gesture-handler": "^1.5.2",
        "react-native-iphone-x-helper": "^1.2.1",
        "react-native-keychain": "^4.0.1",
        "react-native-picker-select": "^6.3.3",
        "react-native-reanimated": "^1.4.0",
        "react-native-screens": "^2.0.0-alpha.17",
        "react-native-svg": "^9.13.3",
        "react-navigation": "^4.0.10",
        "react-navigation-drawer": "^2.3.3",
        "react-navigation-stack": "^1.10.3",
        "react-redux": "^7.1.1",
        "redux": "^4.0.1",
        "redux-logger": "^3.0.6",
        "redux-thunk": "^2.3.0"
    },
    "devDependencies": {
        "@babel/core": "^7.6.2",
        "@babel/preset-env": "^7.2.0",
        "@babel/runtime": "^7.6.2",
        "@types/enzyme": "^3.1.15",
        "@types/enzyme-adapter-react-16": "^1.0.3",
        "@types/jest": "^24.0.12",
        "@types/node": "^12.11.5",
        "@types/react": "^16.8.16",
        "@types/react-native": "^0.60.23",
        "@types/react-native-datepicker": "^1.7.0",
        "@types/react-native-vector-icons": "^6.4.4",
        "@types/react-navigation": "^3.4.0",
        "@types/react-redux": "^7.0.8",
        "@types/react-test-renderer": "^16.8.1",
        "@types/redux-logger": "^3.0.6",
        "@types/sinon": "^7.0.2",
        "babel-jest": "^24.8.0",
        "babel-plugin-transform-remove-console": "^6.9.4",
        "enzyme": "^3.7.0",
        "enzyme-adapter-react-16": "^1.7.0",
        "enzyme-to-json": "^3.3.5",
        "jest": "^24.8.0",
        "jest-fetch-mock": "^2.0.1",
        "metro-react-native-babel-preset": "^0.57.0",
        "pre-commit": "^1.2.2",
        "react-dom": "^16.6.3",
        "react-test-renderer": "^16.12.0",
        "sinon": "^7.2.2",
        "snapshot-diff": "^0.4.1",
        "ts-jest": "^24.0.2",
        "tslint": "^5.17.0",
        "typescript": "^3.7.3"
    },

android/app/build.gradle

dependencies {
    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'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

configurations.all {
     resolutionStrategy {
       force "com.facebook.soloader:soloader:0.8.0"
     }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task 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"

MainActivity.java

package com.dedge.centralinventory;

import android.os.Bundle;
import com.facebook.react.ReactFragmentActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

public class MainActivity extends ReactFragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(null);
    }

    @Override
    protected ReactActivityDelegate createReactActivityDelegate() {
        return new ReactActivityDelegate(this, getMainComponentName()) {
            @Override
            protected ReactRootView createRootView() {
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
            }
        };
    }
}

MainApplication.java

package com.dedge.centralinventory;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
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();
            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); // Remove this line if you don't want Flipper enabled
    }

    /**
     * Loads Flipper in React Native templates.
     *
     * @param context
     */
    private static void initializeFlipper(Context context) {
        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.facebook.flipper.ReactNativeFlipper");
                aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }
        }
    }
}

I tried to remove this line initializeFlipper(this); but it did not change anything.

Using pages of one react native app within another react native application

$
0
0

We currently have 2 react native applications. 1: for authentication and printing. 2: for buying vouchers and processing the voucher sale.

Our task is to have the 2 apps work together in one React native app. Basically authenticating with app 1 and then pressing a button to open pages from app 2. This all needs to happen within one APK.

I am aware that using a single app to do all of the above would be preferable. That is not the aim though.

Any help is appreciated. Thanks in advance.

Can I use a Zebra scanner package with Expo project in React Native?

$
0
0

There is an npm package for Zebra scanners (Barcode scanner with laser/not camera) that we need to use in an Android app we plan to build with React Native. Now Expo CLI seems like the way to go but after some quick research, we are not too sure if this is possible - to include this zebra package in an Expo project. Can you confirm this is the case?

I ask because of the following facts regarding using Expo:

  • You can't add native modules (probably a gamechanger for some)
  • You can't use libraries that use native code in Objective-C/Java

The application should allow a user to use the Zebra scanner running Android OS to scan a barcode and return the scanned data.

Package link: https://www.npmjs.com/package/react-native-zebra-scanner


React-native - Change button icon when processing and should get back to its normal state after the processing is done

$
0
0

how to change Button Icon while it is processing then it should go back to default button icon after the processing is done in React-native.

For Example: I have Microphone icon button and when i click on mic the icon should change to show that it is processing and when recording is done then it should turn back to default Microphone icon.

React Native Android Run Problem with Stucking Old Version without Re-bundling Each Time on MacOS

$
0
0

I could not run the project on the Android without re-bundling each time I want to run my changes. Here is the re-bundling command:

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

After that I could not use react-native run-android because simply it could not find any emulator or physical device however I can find my emulators or devices via adb devices.

When I use react-native run-android it has some errors on the log.

Could not find adb

ADB Problem

It says, 'could not find any device or emulator' and could find the the ADB. However, both directory and devices are okay. I've checked them like 100 times. Therefore, I could not use the command!

I have to use Android Studio to run the project on Emulator or Physical Devices. It works but each time I have to change thing, I have to re-bundle whole android project. Reset the Bundler's cache and then re-run on Android Studio to see my changes. It just kills me :(

I need a solution for better development on Android with React Native. Additional information: I'm working on MacOS. I literally tried everything on the internet but could not find the solution for me.

Integrating react-native into existing Android App

$
0
0

we are trying to integrate react-native into our existing android application: The SDK requirements of our build.gradle are: minSdkVersion 16 targetSdkVersion 23

We use an Intent to call the initial React index.js:

Intent inte = new Intent(this, ReactNativeStarter.class);
startActivity(inte);

The rest of the code is from the react integrating tutorial.

When we try to call our react component we get the following error:

Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' 
     (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/data/at.??????/files/instant-run/dex/slice-com.facebook.react-react-native-0.20.1_3762d580ab3ced1fa2f7503493d38e666994b9fa-classes.dex)
        at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)

Can you help?

Full error log:

12-19 10:07:22.157 30271-32680/at.???? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
    Process: at.?????, PID:
    java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:300)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' 
     (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/data/at.??????/files/instant-run/dex/slice-com.facebook.react-react-native-0.20.1_3762d580ab3ced1fa2f7503493d38e666994b9fa-classes.dex)
        at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)
        at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67)
        at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793)
        at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730)
        at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91)
        at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184)
        at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
        at android.os.AsyncTask$2.call(AsyncTask.java:288)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818) 

How to install package only for iOs in React Native

$
0
0

I would like to know if it's possible to install a package only for iOs in React Native ? I'm using tipsi-stripe for Apple Pay and there is some bugs with Android and RN0.61.5, and I don't need it on Android.

I tried to delete module from Android Studio and from packages.json and it's working but it's not clean, does someone have a better solution ?

App published but not indexed in Google Play after 2 weeks

$
0
0

For a client of ours we've created an app which has to be available by the 11th of October. The app is already available in the iOS App store but Google Play seems to be a problem.

I have added the package to the release track on the 26th of September, hoping it would be reviewed & published shortly after which, luckily, it did. I can use a direct link to the app (taken from the play console) which indicates it is published correctly. The console does not list any errors. Device and country settings have been double checked and all seems to be correct.

Google support has been contacted a few days ago but, unfortunately, there is still no reply from them.

With the deadline coming closer i'm getting less sleep each night.

Does anyone have any experience with this particular issue and hopefully a solution?

Notes

  • App is created with React Native version 0.59.9
  • No advertisements but uses AdMob SDK for Firebase Analytics
  • Package name is "com.kunstmuseum.kunstmuseum"
  • Searching the Play store for: "pub:Kunstmuseum Den Haag" does give me a result.

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kunstmuseum.kunstmuseum"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<application
  android:name=".MainApplication"
  android:allowBackup="true"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
    <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
  </service>
  <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
    <intent-filter>
      <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
    </intent-filter>
  </service>
</application>

build.gradle

apply plugin: "com.android.application"
apply plugin: "com.google.firebase.firebase-perf"
apply plugin: 'io.fabric'

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",

    // Sometimes (like if you use Android API<17) adb forwards don't work, so you need a bundle in the dev APK
    bundleInDebug: project.hasProperty("bundleInDebug") ? project.getProperty("bundleInDebug") : false,
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.kunstmuseum.kunstmuseum"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 5
        versionName "1.4"

        // Needed to support API<21, though there is a small chance proguard shrinks things sufficiently
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // 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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            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-zip-archive')
    implementation project(':react-native-proximity')
    implementation project(':react-native-webview')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-video')
    implementation project(':react-native-svg')
    implementation project(':react-native-sound')
    implementation project(':react-native-shake')
    implementation project(':react-native-audio-jack')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-gesture-handler')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    /* ----------------------------
    *    REACT NATIVE FIREBASE
    * ---------------------------- */

    // Library as defined in settings.gradle
    implementation project(path: ':react-native-firebase')

    // Required dependencies
    //noinspection GradleCompatible
    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.android.gms:play-services-base:16.1.0"

    /* -------------------------
    *   OPTIONAL FIREBASE SDKS
    * ------------------------- */

    implementation('com.google.firebase:firebase-ads:15.0.1') {
      // exclude `customtabs` as the support lib version is out of date
      // we manually add it as a dependency below with a custom version
      exclude group: 'com.android.support', module: 'customtabs'
    }

    // Authentication
    implementation "com.google.firebase:firebase-auth:17.0.0"
    // Analytics
    implementation "com.google.firebase:firebase-analytics:16.5.0"
    // Performance Monitoring
    implementation "com.google.firebase:firebase-perf:17.0.0"
    // Remote Config
    implementation "com.google.firebase:firebase-config:17.0.0"
    // Cloud Storage
    implementation "com.google.firebase:firebase-storage:17.0.0"
    // Dynamic Links
    implementation "com.google.firebase:firebase-dynamic-links:17.0.0"
    // Real-time Database
    implementation "com.google.firebase:firebase-database:17.0.0"
    // Cloud Functions
    implementation "com.google.firebase:firebase-functions:17.0.0"
    // Cloud Firestore
    implementation "com.google.firebase:firebase-firestore:19.0.2"
    // Cloud Messaging / FCM
    implementation "com.google.firebase:firebase-messaging:18.0.0"
    // Crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true
    }

    /* --------------------------------
    *  OPTIONAL SUPPORT LIBS
    * -------------------------------- */

    // Needed to support API<21, though there is a small chance proguard shrinks things sufficiently
    implementation "com.android.support:multidex:1.0.3"

    // For Firebase Ads
    //noinspection GradleCompatible
    implementation "com.android.support:customtabs:27.1.1"

    // For React Native Firebase Notifications
    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'

    // For animated GIF support
    implementation 'com.facebook.fresco:animated-gif:1.10.0'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'
Viewing all 28480 articles
Browse latest View live


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