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

What does @format mean in new react native App.js?

$
0
0

I started to create an Application in react native so, i setup the react native environment and found the @format in the App.js file when i open this file first time. Please can anyone tell what is @format and why it is in the new App.js file in react native?


React Native - IOS device screens zoom in issue in standard mode

$
0
0
  • In my React-Native app, I have shown splash screen from react-native and not (Android/IOS) natively.
  • But when splash screen loads it zooms in automatically and the same behavior is for other screens.
  • It works well in Android but not in IOS.

  • From Xcode(10.1) I have removed LaunchScreen.xib as my splash screen requires some api calls.

AfterBefore

React-native Android release build broken (UI navigation breaks without error) - works correctly in debug build

$
0
0

I have a react-native app which works correctly in Android debug builds but doesn't work in Android the release builds.

The app is using redux, axios and react-navigation:

  • Search input box on the home screen
  • Pressing the "Search button" calls a redux thunk, which makes an API request via axios which updates the redux reducer state
  • The home screen monitors redux reducer state and when we have new search results it navigates to the results screen using react-navigation 

All of this works fine in debug mode both on a real Android device and on the emulator (react-native run-android). 

When I run a release build (react-native run-android --variant=release), it compiles and installs and loads the home screen as before but when I press the search button it doesn't navigate to the search results. There is no error.

Things I have tested:

  • Is the app triggering and exception/error?

    • No there is no error. The app continues to run. Running adb logcat shows allot of log data but i dont see any any new error when launching/testing the app.
  • Is the API request being triggered?

    • Yes. By enabling none SSL traffic (cleartextTrafficPermitted="true") I was able to run Reactotron with the release build and I could see the API request is made and the response data is received. But the log output stops at this point. There is no error.
  • Does the API SSL cert meet android requirements?

    • Yes it does. I have tested it (ssllabs.com). It works in debug mode on a real device so it should work in the release also. 
  • Is an outdated dependancy causing the failure?

    • I tried updating my dependancies to the latest versions. The app continues to work fine in debug mode but breaks in the release.

How do I work out what is causing the failure?

':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.com.android.builder.dexing.DexArchiveMergerException:

$
0
0

Error while merging dex archives:The number of method references in a .dex file cannot exceed 64K.

The code worked properly before add react-native-firebase/admob. But after adding that library build fails. When i removing the react-navigation built. Why these two libraries cannot use same app?

Here is my app.json file and the build.gradle files.

"@react-native-community/masked-view": "^0.1.6",
    "@react-native-firebase/admob": "^6.2.0",
    "@react-native-firebase/app": "^6.2.0",
    "react": "16.8.6",
    "react-native": "0.60.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-indicators": "^0.17.0",
    "react-native-modal": "^11.5.3",
    "react-native-reanimated": "^1.7.0",
    "react-native-responsive-dimensions": "^3.0.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.29",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^2.0.16"
  },

buildscript {
   ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}```

Uploading Audio to Cloudinary

$
0
0

this is my first Stack Overflow post so please go easy on me!

I'm building an audio recording app using EXPO as the SDK with React Native. One of the main features of the app is to be able to to record live audio as well as uploading audio from the client's device. By leveraging Expo's Audio API and FileSystem, I'm successfully able to record and save live audio and then retrieve it via FileSystem to upload, however I'm running in an error when I try to pass the localUri to upload to my Cloudinary database. There is very little documentation in regards to audio and audio uploads to cloudinary are clumped into video uploads so there's nothing audio specific to really point me in the right direction. I've tried converting the URI to base64 as well as a variety of MIME types but the response from Cloudinary with a secure url returns empty/undefined. I've successfully uploaded images with this method so you can imagine how frustrating it is. Here's my code that grabs a recording and tries to upload it to Cloudinary:

      DocumentPicker.getDocumentAsync({
        type: '*/*',
        copyToCacheDirectory: true,
        base64: true
      })
      .then(succ => {
        //check out the saved info
        console.log(succ, `path: ${succ.uri}, type: ${succ.type}, name: ${succ.id}, size: ${succ.size}`)

      let Base64 = {/* Truncated Base64 object*/};

      let base64Aud = `data:audio/x-wav;base64, ${Base64.encode(succ.uri)}`;

      let cloud = `https://api.cloudinary.com/v1_1/${CLOUD_NAME}/upload`;

         const data = {
        'file': base64Aud,
        'upload_preset': CLOUDINARY_UPLOAD_PRESET,
        'resource_type': 'video',
      }
        fetch(cloud, {
          body: JSON.stringify(data),
          headers: {
            'content-type': 'application/x-www-form-urlencoded'
          },
          method: 'POST',
        })
        .then(async r => {
            let data = await r.json()
            console.log('cloudinary url:', data.secure_url)
            return data.secure_url
      })
      .catch(err => console.log(err))
    }

This call prints the following to the console:

Object {
  "name": "20200117_143416.mp4",
  "size": 519612343,
  "type": "success",
  "uri": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Faloud-aaf24bff-8000-47f0-9d1c-0893b81c3cbc/DocumentPicker/c922deb7-fd4f-42d9-9c28-d4f1b4990a4c.mp4",
} path: file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Faloud-aaf24bff-8000-47f0-9d1c-0893b81c3cbc/DocumentPicker/c922deb7-fd4f-42d9-9c28-d4f1b4990a4c.mp4, type: success, name: undefined, size: 519612343
data:audio/x-wav;base64, ZmlsZTovLy9kYXRhL3VzZXIvMC9ob3N0LmV4cC5leHBvbmVudC9jYWNoZS9FeHBlcmllbmNlRGF0YS8lMjU0MGFub255bW91cyUyNTJGYWxvdWQtYWFmMjRiZmYtODAwMC00N2YwLTlkMWMtMDg5M2I4MWMzY2JjL0RvY3VtZW50UGlja2VyL2M5MjJkZWI3LWZkNGYtNDJkOS05YzI4LWQ0ZjFiNDk5MGE0Yy5tcDQ=
cloudinary url: undefined

Does anyone see any glaring issues or have any insight on this issue? Better yet, successfully uploaded audio to Cloudinary from the client using Expo & React Native? Thanks!

launching expo on visual studio android emulator: why do I get a black screen with no error message?

$
0
0

I'm new to expo. I have launched xamarin project succesfully under Visual Studio 2019 but when I want to do the same with expo, I get only a black screen: how can I fix this?

enter image description here

Is there any way to do background tasks in React Native other than react-native-background-task?

$
0
0

I'm trying to do in my React Native App that each X min the app fetch some data of my application included if the app is closed. Or more similar, each X min I want to save a value in the AsyncStorage.

It suppose that the react-native-background-task does that but, unfortunately, the project is abandoned with a lot of errors and bugs that make using it unviable.

Is there any other way to do it?

Camera is not running

$
0
0

I’m trying to make a prototype application that over and over

1- record a video with the camera for x seconds

2- displays this video

For this I use the components Camera from expo-camera and Video from expo-av

For this I have two views :

I use in my code the stateSequence property and the sequencer() function which displays alternately the view with the Camera component which films for x seconds , and the video view which allows me to display the video.

Sequencer() is triggered with setInterval( this.sequencer , 10000) found in the componentWillMount()

I can switch alternately from a View with the Camera component to a View with the Video component.

To record a video with the Camera component I use recordAsync(), but I get the following error:

Unhandled promise rejection: Error: Camera is not running

I’m using an android phone for my tests.

Can’t you help me

this is my code

import { StyleSheet, Text, View ,TouchableOpacity} from 'react-native';

import * as Permissions from 'expo-permissions';
import { Camera } from 'expo-camera';
import { Video } from 'expo-av';
import { Logs } from 'expo';


export default class SequenceViewer extends Component {
  constructor(props) {
    super(props);
    this.state = {
      stateSequence: "SHOOT ",
      hasCameraPermission: null,
      type: Camera.Constants.Type.front,
    }
    this.recordVideo = this.recordVideo.bind(this)
  }

  sequencer = () => {  

    if(this.state.stateSequence==="WATCH"){ 
      this.setState({  stateSequence: "SHOOT",})

      this.recordVideo();  //  Error message   Camera is not running

    } else {
      this.setState({stateSequence: "WATCH"})
    }


  }

  async componentWillMount() {    
    let  rollStatus  = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    let cameraResponse = await Permissions.askAsync(Permissions.CAMERA)
    if (rollStatus.status=='granted'){
      if (cameraResponse.status == 'granted' ){
        let audioResponse = await Permissions.askAsync(Permissions.AUDIO_RECORDING);
        if (audioResponse.status == 'granted'){
          this.setState({ permissionsGranted: true });

          setInterval( this.sequencer , 10000);

        }  
      }
    }                  
  }

  recordVideo = async () => {

            if(this.state.cameraIsRecording){
              this.setState({cameraIsRecording:false})
              this.camera.stopRecording();
            }
            else {
              this.setState({cameraIsRecording:true})
              if (this.camera) {
                let record = await  this.camera.recordAsync(quality='480p',maxDuration=5,mute=true).then( data =>{

                  this.setState( {recVideoUri :data.uri})                         
                }) 
             }   

            }
  };  


  render() {

    const { hasCameraPermission } = this.state
      if(this.state.stateSequence=="WATCH")
      {
        return(
          <View style={styles.container}>
           <Video
              source={{ uri:this.state.recVideoUri }}
              rate={1.0}
              volume={1.0}
              isMuted={false}
              resizeMode="cover"
              shouldPlay
              isLooping
              style={{ width: 300, height: 300 }}
              ref={(ref) => { this.player = ref }}   
            />
        </View>  
        )

      } else
      {
        return(

          <View style={{ flex: 1 }}>
          <Camera style={{ flex: 1 }} type={this.state.type}  ref={ref => {this.camera = ref; }}></Camera>
        </View>

        )
      }
  }
}

const styles = StyleSheet.create({
    viewerText: {
        fontSize: 20,
        fontWeight: 'bold',
    },
    container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
    },
  });

Thank you


Expo android app, PushNotifications doesn't work in standalone apk?

$
0
0

I am facing a problem, when I am running an app through expo client app, PushNotifications works. But if I am building a standalone .apk, I need to install expo client, in order to get pushtoken. And, when expo client is not turned on, I cannot get pushtoken. So my customer needs to install 2 apps. One is mine, built standalone .apk, and other is expo client. It is tedious flow..

React Native : Expiring Daemon because JVM heap space is exhausted?

$
0
0

I just updated the Android Studio to 3.5.0 and I'm getting Expiring Daemon because JVM heap space is exhausted . Message while the build is running. Also, the build is taking more time to complete. Does anyone have any idea regarding this error help me?

App crashes after upgrading expo from 35 to 36

$
0
0

I updated my expo SDK from 35 to 36. Android build does not work on android x versions. The application gives error after splash screen. "Application keeps stopping". and no error.

While I am on the development mode my expo app works fine but once I build it crashes. I am also using sentry for capturing my errors but it seems my app is not loading so sentry can send me error logs.

React Native onFocus and onBlur TouchableOpacity

$
0
0

I am using react natives Touchable Opacity to animate/give an effect to the box I am hovering over. I am developing an app for android TV. I wanted to make a hover effect similar to the default android tv home screen (When navigating, on focus, the cards enlarge and on blur the cards get smaller). I am also using map to iterate over many items. Here is what I have got so far.


import React, { Component } from 'react';
import { StyleSheet, View, TouchableOpacity } from 'react-native';

export default class TV extends Component {

    constructor(props) {
        super(props);
        this.state = {
            bgColor: 'gray',
            entries: [
                {
                    "albumId": 1,
                    "id": 1,
                    "title": "accusamus beatae ad facilis cum similique qui sunt",
                    "url": "https://via.placeholder.com/600/92c952",
                    "thumbnailUrl": "https://via.placeholder.com/150/92c952"
                },
                {
                    "albumId": 1,
                    "id": 2,
                    "title": "reprehenderit est deserunt velit ipsam",
                    "url": "https://via.placeholder.com/600/771796",
                    "thumbnailUrl": "https://via.placeholder.com/150/771796"
                }]
        }
    }


        render () {
        return (
            <View style={styles.thumbnailContainer}>
                {
                    this.state.entries.map((e, index) => {
                        return(

                                <TouchableOpacity onPress={()=>null} onFocus={()=>this.setState({bgColor: 'red'})} onBlur={()=>this.setState({bgColor: 'gray'})}>
                                    <View style={styles.thumbnailWrapper}></View>
                                </TouchableOpacity>

                            )
                    })
                }
            </View>
        );
    }
}

const styles = StyleSheet.create({
    thumbnailContainer: {
      flex: 1,
      flexDirection:'row',
      flexWrap:'wrap'
    },
    thumbnailWrapper: {
        backgroundColor: 'gray',
        width: 50,
        height: 50
    }
})

I am currently testing with background color only. Not sure how I can get the style background color to change. It gives me a undefined is not an object (evaluating this.state) if I do backgroundColor: this.state.bgColor.

So How can I animate the "Cards" or in this case just plain views when focused on and blurred on.

After importing react-native-firebase/firestore in to my app, I get the build error 'Could not find com.google.firebase:firebase-bom:21.3.0.'

$
0
0

I have just added react-native-firebase/firestore v6.2.0 to my React Native app. It was previously building fine whilst using the auth and messaging modules.

Now when I build the app I get the error:

> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.firebase:firebase-bom:21.3.0.
     Searched in the following locations:
       ...
     Required by:
         project :app > project :@react-native-firebase_messaging
         project :app > project :@react-native-firebase_app
         project :app > project :@react-native-firebase_auth

I'm not sure what this file is or why it would have been removed.

Any help much appreciated!

Error while updating property 'defaultSrc' of a view managed by: RCTImageView (android pre-launch report)

$
0
0

I'm seeing a crash related to a possible memory leak due to images on my react native app. I can't reproduce, but every time I deploy to the play store, one of my pre-launch devices (the Moto Z running android 7.0) crashes with this error (full stack trace below!).

com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'defaultSrc' of a view managed by: RCTImageView

I can't repro myself ,and consistently see this crash for JUST the Moto Z (the other 10 devices work fine). Some users in prod have reported crashing, with this error

java.lang.RuntimeExceptionDisplayListCanvas.java:229
Canvas: trying to draw too large(345855600bytes) bitmap.

These both started happening around the same time (after a major redesign), and seem to be connected.

I've tried enabling largeHeap and disabling hardwareAcceleration in the Android manifest. I've also updated to the latest version of React-Native 0.60.5.

Here are my dependencies:

"dependencies": {
    "apollo-cache-redux": "^0.1.0",
    "apollo-client": "^2.2.7",
    "apollo-link": "^1.2.1",
    "apollo-link-context": "^1.0.8",
    "apollo-link-error": "^1.0.9",
    "apollo-link-http": "^1.5.3",
    "apollo-link-redux": "^0.2.1",
    "axios": "^0.18.1",
    "bugsnag-react-native": "^2.10.2",
    "create-react-native-app": "^1.0.0",
    "global": "^4.3.2",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.8.0",
    "immutability-helper": "^2.7.0",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.13",
    "moment": "^2.21.0",
    "prop-types": "^15.6.1",
    "react": "16.8.6",
    "react-apollo": "^2.1.3",
    "react-native": "0.60.5",
    "react-native-auth0": "^1.3.0",
    "react-native-autolink": "^1.4.0",
    "react-native-cli": "^2.0.1",
    "react-native-fontawesome": "^5.7.0",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-image-picker": "^0.26.10",
    "react-native-image-resizer": "^1.0.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-push-notification": "^3.0.2",
    "react-native-simple-store": "^1.3.0",
    "react-native-vector-icons": "^6.3.0",
    "react-navigation": "^3.3.0",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-devtools-extension": "^2.13.2",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.8.0",
    "eslint": "^6.1.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "prettier": "^1.11.1",
    "react-test-renderer": "16.8.6"
  },
FATAL EXCEPTION: main
Process: com.parade, PID: 11503
com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'defaultSrc' of a view managed by: RCTImageView
    at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:98)
    at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:131)
    at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:51)
    at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:46)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:268)
    at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:198)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1036)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1007)
    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:172)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:84)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:869)
    at android.view.Choreographer.doCallbacks(Choreographer.java:683)
    at android.view.Choreographer.doFrame(Choreographer.java:616)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6123)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Method.java)
    at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:83)
    ... 21 more
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 614854412 byte allocation with 8448244 free bytes and 499MB until OOM
    at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
    at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java)
    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:620)
    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:455)
    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1152)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:724)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:575)
    at android.content.res.Resources.getDrawable(Resources.java:767)
    at android.content.res.Resources.getDrawable(Resources.java:738)
    at com.facebook.react.views.imagehelper.ResourceDrawableIdHelper.getResourceDrawable(ResourceDrawableIdHelper.java:78)
    at com.facebook.react.views.image.ReactImageView.setDefaultSource(ReactImageView.java:377)
    at com.facebook.react.views.image.ReactImageManager.setDefaultSource(ReactImageManager.java:94)
    ... 23 more

Metro bundler stops after "Loading dependency graph, done"

$
0
0

I'm just starting to RN from ReactJs and I have been trying to run a React-Native Project, but when I type react-native start the Metro bundler stops at this line : Loading dependency graph, done.

I can notice this isn't right because it doesn't load my code changes and it gives me the error "cannot connect to the development server" after I reload the emulator.

I did some research and it should also tell that it is bundling a specific file something like this:

BUNDLE [android, dev] ./index.js

current Metro bundler logs

I can only see the changes after I run "raect-native run-android"

react-native version:

react-native-cli: 2.0.1 react-native: 0.61.5

I can provide more versions if needed.


Error while installing react native app in MIUI device

$
0
0

In my MIUI device USB debugging is enabled and MIUI optimization is disabled. But when I run react-native run-android command. I have such error:

Installing APK 'app-debug.apk' on 'Redmi Note 3 - 5.0.2' for app:debug
Unable to install C:\Users\admin\FirstProject\android\app\build\outputs\apk\app-debug.apk
com.android.ddmlib.InstallException: Failed to install all
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:89)
at com.android.ddmlib.Device.installPackages(Device.java:904)
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:137)
at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:228)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:621)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:604)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    06:42:06 E/1316520576: Error while uploading app-debug.apk : Unknown failure ([CDS]close[0])
    :app:installDebug FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:installDebug'.
    > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to install all

I could not find the solution over the Internet, please help me, I want to run React native app on my device!

Expo in-app-purchases: ReferenceError: Can't find variable: connectAsync

$
0
0

I'm trying to follow along with expo's in app purchases documentation.. I have the android developer account and set up my in-app-purchase on that account for the same app. I'm just trying to get started with the documentation and receive an error immediately.

If you look at the documentation, I'm just trying to enter in what's in the first example. I call this function at the beginning of the render method of my app.

import * as InAppPurchases from 'expo-in-app-purchases';
...

const getHistory = async function(){ 
  const history = await connectAsync();
    if (history.responseCode === IAPResponseCode.OK) {
      history.results.forEach(result => {
        console.log(result)
      });
    }
}

And I receive these errors

[Unhandled promise rejection: ReferenceError: Can't find variable: connectAsync]
* App.js:57:19 in getHistory
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:170:17 in Promise$argument_0
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo

...

React-Native Android ScrollView can't get event from onScroll

$
0
0

If there is only one item or few items in ScrollView on Android, I won't get any event from onScorll. In iOS, I still could get the event because the bounces.

My problem is how could I listen to the scroll offset on Android with a list? I've tried PanResponder, but in my case, I would like to detect the swipe down and up gesture in a vertical Flatlist.

React native android APK release build failed

$
0
0

I have tried to build release build APK for my project. The project is perfectly working in the simulator. The problem is, showing some errors. I cannot trace what is the error about. Please check the below screenshot for errors.

Build Error

Code used for APK generation: cd android && gradlew assembleRelease

Please check the below Gradle properties, if anything is wrong.

build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]

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

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def 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.raottsworld"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 12
        versionName "1.2.0"
        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 {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    buildTypes {
        debug {
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        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.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        innerTest {
            matchingFallbacks = ['debug', '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:
            // 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 fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':@react-native-community_async-storage')
    implementation project(':@react-native-community_netinfo')
    implementation project(':react-native-gesture-handler')

    implementation "com.android.support:multidex:1.0.3"
    implementation project(":react-native-image-zoom")
    implementation project(":react-native-photo-view")
    implementation project(":react-native-vector-icons")
    implementation project(":react-native-video")
    implementation project(":react-native-maps")
    implementation project(":RNPermissionsModule")
    implementation (project(":react-native-fcm")) {
        exclude group: "com.google.firebase"
    }
    implementation (project(":react-native-maps")) {
        exclude group: "com.google.android.gms", module: "play-services-base"
        exclude group: "com.google.android.gms", module: "play-services-maps"
    }
    implementation ("com.google.android.gms:play-services-base:10.2.1") {
        force = true;
    }
    implementation ("com.google.android.gms:play-services-maps:10.2.1") {
        force = true;
    }
    implementation project(":react-native-image-picker")
    implementation project(":react-native-camera")
    implementation project(":react-native-fcm")
    implementation project(":react-native-svg")
    implementation ('com.google.firebase:firebase-messaging:10.2.1') {
        force = true;
    }

    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 use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

// apply plugin: "com.google.gms.google-services"

apply from: file("../../node_modules/@react-native-community/cli-platform- 
android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Versions Used

"react": "16.9.0",
"react-native": "0.61.5",

I am stuck in the above error, really need help to fix the error.

Crash on 64-bit armv8 device which have Mediatek MT6735P chipset with Cortex-A53 CPU

$
0
0

Crash on 64-bit armv8 devices with below stack trace. Checked with few different Android System WebView versions including latest beta version (77.0.3865.73).

To Reproduce: Create a project with react-native init AwesomeProject --0.60.5 Install the the react-native-webview using React Native WebView Getting Started Guide

Stack trace

E/unknown:ReactNative: Exception in native call
    android.content.res.Resources$NotFoundException: String resource ID #0x3040003
        at android.content.res.HwResources.getText(HwResources.java:1287)
        at android.content.res.Resources.getString(Resources.java:431)
        at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:709)
        at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:633)
        at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:685)
        at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:834)
        at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:670)
        at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:605)
        at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:319)
        at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:104)
        at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:271)
        at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:131)
        at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:118)
        at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
        at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:115)
        at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:268)
        at android.webkit.WebView.<init>(WebView.java:597)
        at android.webkit.WebView.<init>(WebView.java:531)
        at android.webkit.WebView.<init>(WebView.java:514)
        at android.webkit.WebView.<init>(WebView.java:501)
        at android.webkit.WebView.<init>(WebView.java:491)
        at com.reactnativecommunity.webview.RNCWebViewManager$RNCWebView.<init>(RNCWebViewManager.java:902)
        at com.reactnativecommunity.webview.RNCWebViewManager.createRNCWebViewInstance(RNCWebViewManager.java:154)
        at com.reactnativecommunity.webview.RNCWebViewManager.createViewInstance(RNCWebViewManager.java:160)
        at com.reactnativecommunity.webview.RNCWebViewManager.createViewInstance(RNCWebViewManager.java:104)
        at com.facebook.react.uimanager.ViewManager.createViewInstanceWithProps(ViewManager.java:119)
        at com.facebook.react.uimanager.ViewManager.createViewWithProps(ViewManager.java:66)
        at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:259)
        at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:198)
        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1036)
        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1007)
        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:172)
        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:84)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:798)
        at android.view.Choreographer.doCallbacks(Choreographer.java:603)
        at android.view.Choreographer.doFrame(Choreographer.java:571)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
        at android.os.Handler.handleCallback(Handler.java:815)
        at android.os.Handler.dispatchMessage(Handler.java:104)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5667)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:962)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Screenshots:enter image description here

Viewing all 29901 articles
Browse latest View live


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