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

React-Native Android Studio Project Build failed showing "Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0."

$
0
0

I'm working on a "React-Native" project and it is not building the project in Android Studio by showing the error "Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0."

And the issue is accessing the file as it is showing "The process cannot access the file because it is being used by another process."

When I build the project, it shows the exception as under:

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:processDebugResources'.> java.nio.file.FileSystemException: E:\TrackFriends\android\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_: The process cannot access the file because it is being used by another process.* 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.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 2s43 actionable tasks: 2 executed, 41 up-to-date

Any solution how to solve it? My project packages are as under:

"react": "16.8.3","react-native": "^0.59.9","react-native-elements": "^1.1.0","react-native-firebase": "^5.3.1","react-native-gesture-handler": "^1.1.0","react-native-maps": "^0.24.2","react-native-vector-icons": "^6.6.0","react-navigation": "^3.6.1"

React Native project can't be open with android emulator

$
0
0

I'm a newbie to react native. I started a new project and followed all the steps. I had Android Studio before and I started the emulator with it. After running npx react-native run-android command I get this error.

**FAILURE: Build failed with an exception.* What went wrong:Task 'installDebug' not found in project ':app'.* Try:Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 34serror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* What went wrong:Task 'installDebug' not found in project ':app'.* Try:Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 34s**

Then I ran abd -d command and I get this.

Android Debug Bridge version 1.0.41Version 29.0.6-6198805Installed as C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe

Can you please help me with this?

How to set ReactNative app as default system app?

$
0
0

Actually, I am working on a ReactNative app like TrueCaller.

The problem is how to show the received call in my app instead of the default system UI?

Regards

React Native - Android: Why are online images (url) not showing only on Android RELEASE build?

$
0
0

I have an application that loads images from url with an https, all images are working fine on iOS, and it also works fine when run through react-native run-android (emulator or actual device). However when I try to run the release version through the apk or through react-native run-android --variant=release, the images doesn't show anymore. Is there any additionaal configuration that needs to be done on Android for it to work on release?

Sample code snippet of Image usage:

<Image source={props.image} style={styles.profile} />

P.S. I am using the latest version of React Native v0.61.5

Here are some sample screenshots:

Android Release Build:enter image description here

Test Build:enter image description here

React Native second ScrollView not working

$
0
0

My app is developed by react-native(0.62.2) and is depended by react-native-elements(2.0.0). a screen of app must include two ScrollView element. First ScrollView will be used for page scrolling, second ScrollView will be used in existing words card. First ScrollView element is working but second ScrollView element not scrolling in card element. I try wrapper view element with using style {flex:1} but there was no result.

<ScrollView>            // other items ...            {            wordSetObject.words.length == 0 ? null :<Card  title="Existing Words" dividerStyle={{marginBottom:0}} containerStyle={{maxHeight:300}}><ScrollView>                            {                            wordSetObject.words.map((item, index) => {                                return(<ListItem                                    key={index}                                    title={item.word}                                     subtitle={item.meaning}                                    bottomDivider                                    rightIcon={<View style={{flexDirection:'row'}}><MCIcon                                            name="pencil"                                            size={22}                                            /><MCIcon                                            name="delete"                                            size={22}                                            color="red"                                            onPress={() => onPressDeleteWordButton(index)}                                        /></View>                                    }                                    />)                                 })                                }</ScrollView></Card>            }</ScrollView>

java.lang.RuntimeException Unable to instantiate activity ComponentInfo

$
0
0

I am getting an error saying unable to instantiate activity. This activity is a module ModuleX which is inside the main project and also it's enabled for dynamic feature.

Also, I have recently added one another library TwilioRN on the main project ProjectX. Both ModuleX and TwilioRN has the same dependencies using same version.

ProjectX - build.gradle    - implementation project(':react-native-twilio-video-webrtc')        - dependencies             - implementation 'com.twilio:video-android:5.6.0' - ModuleX    - build.gradle       - implementation 'com.twilio:video-android:5.6.0'

Actual Behaviour:

  • when I removed TwilioRN from main project, com.projectX/com.moduleX.videocall.VideoActivity activity started successfully and it worked.
  • But when twilioRN are present, VideoActivity activity is not called and getting crashed.

Expected Behaviour:

VideoCallAcitivity of ModuleX should start even when added TwilioRN library.

Log:

java.lang.RuntimeException Unable to instantiate activity ComponentInfo{com.projectX/com.moduleX.videocall.VideoActivity}: java.lang.ClassNotFoundException: Didn't find class "com.moduleX.videocall.VideoActivity" on path: DexPathList[[zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/base.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.en.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.x86.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.xxxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/base.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.en.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.x86.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.xxxhdpi.apk!/lib/x86, /system/lib]]     ActivityThread.java:2843 android.app.ActivityThread.performLaunchActivity    ActivityThread.java:3048 android.app.ActivityThread.handleLaunchActivity    LaunchActivityItem.java:78 android.app.servertransaction.LaunchActivityItem.execute    TransactionExecutor.java:108 android.app.servertransaction.TransactionExecutor.executeCallbacks    TransactionExecutor.java:68 android.app.servertransaction.TransactionExecutor.execute    ActivityThread.java:1808 android.app.ActivityThread$H.handleMessage    Handler.java:106 android.os.Handler.dispatchMessage    Looper.java:193 android.os.Looper.loop    ActivityThread.java:6669 android.app.ActivityThread.main    Method.java:-2 java.lang.reflect.Method.invoke    RuntimeInit.java:493 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run    ZygoteInit.java:858 com.android.internal.os.ZygoteInit.mainCaused by: java.lang.ClassNotFoundException Didn't find class "com.moduleX.videocall.VideoActivity" on path: DexPathList[[zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/base.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.en.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.x86.apk", zip file "/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.xxxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/base.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.en.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.x86.apk!/lib/x86, /data/app/com.projectX-keGmsJJoT8rTJ-j07QeHwg==/split_config.xxxhdpi.apk!/lib/x86, /system/lib]] BaseDexClassLoader.java:134 dalvik.system.BaseDexClassLoader.findClassClassLoader.java:379 java.lang.ClassLoader.loadClassClassLoader.java:312 java.lang.ClassLoader.loadClassAppComponentFactory.java:69 android.app.AppComponentFactory.instantiateActivityCoreComponentFactory.java:43 android.support.v4.app.CoreComponentFactory.instantiateActivityInstrumentation.java:1215 android.app.Instrumentation.newActivityActivityThread.java:2831 android.app.ActivityThread.performLaunchActivityActivityThread.java:3048 android.app.ActivityThread.handleLaunchActivityLaunchActivityItem.java:78 android.app.servertransaction.LaunchActivityItem.executeTransactionExecutor.java:108 android.app.servertransaction.TransactionExecutor.executeCallbacksTransactionExecutor.java:68 android.app.servertransaction.TransactionExecutor.executeActivityThread.java:1808 android.app.ActivityThread$H.handleMessageHandler.java:106 android.os.Handler.dispatchMessageLooper.java:193 android.os.Looper.loopActivityThread.java:6669 android.app.ActivityThread.mainMethod.java:-2 java.lang.reflect.Method.invokeRuntimeInit.java:493 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.runZygoteInit.java:858 com.android.internal.os.ZygoteInit.main

Render flatlist items over each other(overlap)

$
0
0

I wanna achieve what you can see in image belo, but i have no idea to make flat list items overlap each other:enter image description here

forget about the right and left icons, im just asking for a way for middle container which has cards rendering on each other. tnx in advance

global.nativeTraceBeginSection is not a function. Systrace error - React Native Android

$
0
0

I am trying to use Systrace for Android development using React Native and want to monitor the performance. Whenever i try to use Systrace, it gives the following error:enter image description here


Deep link is not working in android react native

$
0
0

I have setup a deep link in android react native. I wanted to skip the options menu when click on the link, for that I have added .well-known/assetlinks.json file over my domain address.I can see no errors when I verify using this, no error is shown.

assetlinks.json file:

[{"relation": ["delegate_permission/common.handle_all_urls"],"target": {"namespace": "android_app","package_name": "<package-name>","sha256_cert_fingerprints": [<SHA>] }}]

Response of digitalassetlinks

{"statements": [ {"source": {"web": {"site": "<domain>."    }  },"relation": "delegate_permission/common.handle_all_urls","target": {"androidApp": {"packageName": "<package-name>","certificate": {"sha256Fingerprint": "<SHA>"      }    }  }}],"maxAge": "59.999586063s","debugString": "********************* ERRORS *********************\nNone!\n********************* INFO MESSAGES *********************\n* Info: The following statements were considered when processing the request:\n\n---\nSource:

AndroidManifest:

<intent-filter android:label="@string/app_name" android:autoVerify="true"><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="http" android:host="domain" /><data android:scheme="https" /></intent-filter>

MainActivity.java

public class MainActivity extends ReactActivity {/** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */@Overrideprotected String getMainComponentName() {    return "<package-name>";}@Overrideprotected ReactActivityDelegate createReactActivityDelegate() {    return new ReactActivityDelegate(this, getMainComponentName()) {        @Override        protected ReactRootView createRootView() {            return new RNGestureHandlerEnabledRootView(MainActivity.this);        }    };}@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    // ATTENTION: This was auto-generated to handle app links.    Intent appLinkIntent = getIntent();    String appLinkAction = appLinkIntent.getAction();    Uri appLinkData = appLinkIntent.getData();    }}

FYI: When did the recommended exercise for IOS, it's working fine.

Integrate an react native app with the contacts

$
0
0

I'm using react-native to make an multiplatform VOIP Dialer, and i'm facing difficuties to integrate my app with the default contacts list of the o.s (Android on the below example)

enter image description here

I didn't tried anything already because i dont know Java (For android) neither objective-c (For IOS). So i was hoping there's a module for that

Thanks in advance!

Entire react native app showing on lockscreen

$
0
0

I have an app with the following code on the MainActivity.java:

package com.MyApp;import com.facebook.react.ReactActivity;import com.facebook.react.ReactActivityDelegate;import com.facebook.react.ReactRootView;import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;import android.view.Window;import android.view.WindowManager;import android.os.Bundle;import com.MyApp.CustomLockscreenPackage; public class MainActivity extends ReactActivity {    @Override    protected String getMainComponentName() {        return "MyApp";    }    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        Window w = getWindow();        w.setFlags(            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED        );    }    @Override    protected ReactActivityDelegate createReactActivityDelegate() {        return new ReactActivityDelegate(this, getMainComponentName()) {            @Override            protected ReactRootView createRootView() {                return new RNGestureHandlerEnabledRootView(MainActivity.this);            }        };    }}

The lines who make the app work on the lockscreen are:

    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        Window w = getWindow();        w.setFlags(            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED        );    }

But, the entire app works on the lockscreen, and i need to make only certain screens works on the lockscreen (It's a call app).I tried creating a native module but don't worked.i know its possible remove the flags with:

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

So, if i can call these lines on my react native screen, it probably can work

[EDIT]: I made a module who does that for me: react-native-keep-awake

React Navigation Android Animation

$
0
0

recently I have started working with Android System in React Native. When I used Stack Navigator in Tab Navigator, Animation of stack navigation had begun lagging. Actually when I back from Screen which has hidden tab to Screen with tab there is some lags, without tab everything is going OK. I changed default android animation to IOS default animation, but it did not fix that.

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

$
0
0

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

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

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

Info about my environment:

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

android/app/build.gradle below:

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

android/build.gradle below :

buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 16        compileSdkVersion = 28        targetSdkVersion = 28    }    repositories {        google()        jcenter()    }    dependencies {        classpath "com.android.tools.build:gradle:3.4.2"        classpath 'com.google.gms:google-services:4.3.2'    }}allprojects {    repositories {        mavenLocal()        maven {            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm            url("$rootDir/../node_modules/react-native/android")        }        maven {            // Android JSC is installed from npm            url("$rootDir/../node_modules/jsc-android/dist")        }        google()        jcenter()        maven { url 'https://jitpack.io' }    }}

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

RangeError: Maximum call stack size exceeded error in React Native

$
0
0

I want to update the state with the data received as a result of the Sqlite query. But, after updating the situation many times, RangeError: Maximum call stack gives you an exceeded error. Also, state updates are getting slower and eventually failing. The source of the problem is about updating the state many times. How do I solve this problem.

Example simple code (It gives an error after about 130 clicks.):

const [deneme, setDeneme] = React.useState(0);function stateDeneme(){setDeneme(deneme + 1);}<Button title="+1" onPress={ () => stateDeneme() } /><Text>{deneme}</Text>

React Native Navigation Error:the component for the route must be a React Component

$
0
0

Hello Every one I am new to react native I am building a very simple navigation system but i am getting this error.Please any one guide me enter image description hereThe screenshot attached above is the error i am running on my physical android phone S7 edge Oreo 8.0

***Homescreen.js***import React from "react";import { Text, StyleSheet } from "react-native";const HomeScreen = () => {  return <Text style={styles.text}>Hello World</Text>;};const styles = StyleSheet.create({  text: {    fontSize: 30  }});

***App.js***import { createAppContainer } from 'react-navigation';import { createStackNavigator } from 'react-navigation-stack';import HomeScreen from './src/screens/HomeScreen'import ComponentsScreen from './src/screens/ComponentsScreen'const navigator = createStackNavigator(  {    Home: HomeScreen,    Components:ComponentsScreen  },  {    initialRouteName: 'Components',    defaultNavigationOptions: {      title: "App"    }  });export default createAppContainer(navigator);

***ComponentsScreen.js***import React from 'react'import {Text,StyleSheet} from 'react-native'const ComponentsScreen=function(){    return <Text style={styles.textStyle}>This is the Components Screen</Text>}const styles=StyleSheet.create({    textStyle:{    fontSize:30    }})

Android-studio: Unable to locate adb

$
0
0

I read the answers "unable to locate adb" using Android Studio and Error:Unable to locate adb within SDK in Android Studio and it didn't solve my problem.

I use the 4.0 android-studio and Ubuntu 18.04

When I click on "launch this AVD in the emulator", I get an error message "Unable to locate adb".I did look in the Android/Sdk/platform-tools, I have an "adb" executable.

After the "unable to locate adb" error message, the AVD still launches. But, when I try to run my react native app on it, I get the error

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

I'm pretty sure the react-native part is fine, but that route to the emulator is not the same as before.

It was working before. Yesterday, out of the blue, when I launched my android-studio, it "restarted" (showing me the install wizard, etc), and it seems it messed up its configuration.

EDIT: [bad way] I created a new ubuntu user, re-install android studio + react-native. I still get the error message, still the AVD launches, but now React-native can install the app on it. So, now I can work with my new user, but I did not fix the problem.

Intent.ACTION_SEND from react native

$
0
0

I am attempting to send a .pdf to MobiPrint through an android intent. I have an example in Kotlin, but the problem is, I'm using React Native (inside of Expo) and haven't been able to translate it properly yet.

This is Kotlin code

val path: String? = _uri?.pathif(path != null) {    val intent = Intent(Intent.ACTION_SEND)    intent.setClassName(“com.mobiprintpro.retail.android“,“com.mobiprintpro.retail.android.ActivitySend“    )    intent.putExtra("companyCode", "")    intent.putExtra(Intent.EXTRA_STREAM, _uri)    intent.putExtra("fileUri", _uri.toString())    intent.type = "application/pdf"    intent.flags = Intent.FLAG_ACTIVITY_NO_HISTORY    startActivity(intent)}

Expo does have an intent launcher: import * as IntentLauncher from 'expo-intent-launcher';, however it does not seem to include Intent.ACTION_SEND. I'm not against ejecting from expo if need be, however I have yet to find a solution for React Native outside of Expo either. If anyone could point me in the right direction it would be greatly appreciated.

react native enable hot reload/fast refresh for node_module java file

$
0
0

After react-native run-android, device was able to auto-refresh each time if I made change on my code.

But code in node_module behaved slightly different from what I expect. It still works perfectly on modifying the js/tsx, etc file, but change java file or native module wouldn't trigger any change unless I rerun react-native run-android.

Is this the default behavior or I miss something from my configuration.

React-native - tab navigator nested inside drawer

$
0
0

So as title suggest I'm trying to create drawer navigator, which inside has a screen with bottomTabNavigator. Drawer navigator works fine but when I enter route containing tab navigator it's empty.Here's my code

Component with Drawer navigation:

//imports...const Burger = ({ navigation }) => (<View style={styles.burger}><TouchableOpacity onPress={navigation.toggleDrawer}><MaterialCommunityIcons name="forwardburger" size={24} color="black" /></TouchableOpacity></View>);const Home = ({ navigation }) => (<SafeAreaView style={styles.view}><Burger navigation={navigation} /><HomeScreen /></SafeAreaView>);const Auth = ({ navigation }) => (<SafeAreaView style={styles.view}><Burger navigation={navigation} /><AuthScreen /></SafeAreaView>);const Project = ({ navigation }) => (<SafeAreaView style={styles.view}><Burger navigation={navigation} /><CreateProject /></SafeAreaView>);const Drawer = createDrawerNavigator();function Navigation() { // main drawer navigation  return (<NavigationContainer><Drawer.Navigator initialRouteName="Home"><Drawer.Screen name="Home" component={Home} /><Drawer.Screen name="Project" component={Project} /> // screen with bottom tab navigation<Drawer.Screen name="Auth" component={Auth} /></Drawer.Navigator></NavigationContainer>  );}export default function App() {  return (<SafeAreaProvider><Navigation /></SafeAreaProvider>  );}

Aaaaand component with bottom tab navigator:

const Tab = createBottomTabNavigator();const CreateProject = ({ navigation }) => {  console.log('navigation', navigation);  return (<Tab.Navigator      initialRouteName="Description"      screenOptions={({ route }) => ({        tabBarIcon: ({ focused, color, size }) => {          let icon;          switch (route.name) {            case 'Description': {              const iconName = focused ? 'subtitles' : 'subtitles-outline';              icon = (<MaterialCommunityIcons                  name={iconName}                  size={size}                  color={color}                />              );              break;            }            case 'Content': {              const iconName = focused                ? 'table-column'                : 'table-column-plus-after';              icon = (<MaterialCommunityIcons                  name={iconName}                  size={size}                  color={color}                />              );              break;            }            case 'Goals': {              const iconName = focused ? 'target' : 'target-variant';              icon = (<MaterialCommunityIcons                  name={iconName}                  size={size}                  color={color}                />              );              break;            }            default: {              const iconName = focused ? 'cash-multiple' : 'cash';              icon = (<MaterialCommunityIcons                  name={iconName}                  size={size}                  color={color}                />              );            }          }          return icon;        },      })}      tabBarOptions={{        activeTintColor: 'tomato',        inactiveTintColor: 'gray',      }}><Tab.Screen name="Description" component={Description} /><Tab.Screen name="Content" component={Content} /><Tab.Screen name="Goals" component={Goals} /><Tab.Screen name="Prizes" component={Prizes} /></Tab.Navigator>  );};export default CreateProject;

So. All drawer routes work fine, there is event stack navigator inside one of them and it also works fine. But when I enter "bottom tab route" there's nothing on the screen. No content from any of the sub routes, no bottom tab, nothing (no errors as well)Where am I making a mistake?

Type androidx.appcompat.resources.R$dimen is defined multiple times

$
0
0

We have a React Native app where after upgrading to Android Studio 3.6.1 and Gradle plugin 3.6.1 we are seeing this compilation error:

Type androidx.appcompat.resources.R$dimen is defined multiple times: /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/androidx/appcompat/resources/R$dimen.dex, /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/15bdf8225afad69777cd7f9bd328ab094900c8289014e0107b56c5c62099dfea_3.jar:classes.dex

Here are our dependencies:

"dependencies": {"@dblackker/cameraroll": "^1.3.4","@react-native-community/async-storage": "^1.7.1","@react-native-community/geolocation": "^2.0.2","@react-native-community/netinfo": "^4.4.0","@react-native-community/push-notification-ios": "^1.0.6","@react-native-firebase/analytics": "^6.2.0","@react-native-firebase/app": "^6.2.0","@react-native-firebase/crashlytics": "^6.2.0","@react-native-firebase/perf": "^6.2.0","appcenter": "^2.6.1","appcenter-analytics": "^2.6.1","appcenter-crashes": "^2.6.1","axios": "^0.18.0","clone": "^2.1.2","immutability-helper": "^2.8.1","lodash": "^4.17.14","memoize-one": "^5.1.1","moment": "^2.22.2","prop-types": "^15.7.2","react": "16.9.0","react-custom-validation": "^0.5.7","react-native": "0.61.5","react-native-add-calendar-event": "^3.0.0","react-native-app-intro-slider": "^3.0.0","react-native-appearance": "^0.3.1","react-native-camera": "^3.8.0","react-native-contacts": "^5.0.6","react-native-device-info": "^4.0.1","react-native-gesture-handler": "^1.4.1","react-native-heic-converter": "^1.3.0","react-native-image-crop-picker": "^0.26.1","react-native-image-resizer": "^1.0.1","react-native-inappbrowser-reborn": "^3.1.0","react-native-iphone-x-helper": "^1.2.1","react-native-keyboard-aware-scroll-view": "^0.7.4","react-native-linear-gradient": "^2.5.6","react-native-maps": "0.26.1","react-native-modal": "^7.0.2","react-native-modal-datetime-picker": "^7.6.1","react-native-parsed-text": "^0.0.21","react-native-permissions": "^2.0.9","react-native-push-notification": "^3.1.9","react-native-reanimated": "^1.3.0","react-native-section-list-get-item-layout": "^2.2.3","react-native-shadow": "^1.2.2","react-native-share": "^2.0.0","react-native-svg": "^9.12.0","react-native-svg-uri": "^1.2.3","react-native-tab-view": "^2.3.0","react-native-version-number": "^0.3.6","react-navigation": "3.12.0","react-navigation-tabs": "^2.1.2","react-redux": "^5.0.7","redux": "^4.0.4","redux-thunk": "^2.3.0","rn-fetch-blob": "^0.11.2","validator": "^10.8.0"  }

Can anyone help figure out what the issue is, and how could we debug this type of issue in the future? Thank you!

Viewing all 28468 articles
Browse latest View live


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