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

React Native: Determine number of lines of Text component

$
0
0

As the title says, I've been trying to find a way to determine the number of lines the text component AFTER it has been given text. Look at my example below.

<Text>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi semper ut ipsum in ultrices. Vivamus fringilla lacinia odio in accumsan. Proin sit amet pellentesque tortor. Nam mollis sit amet ligula id convallis. Etiam in semper diam. Cras id elit consectetur, interdum ante id, tincidunt nisi. Integer non elit placerat, dignissim nibh at, faucibus sem. Curabitur nec posuere turpis. Vivamus rhoncus nulla vitae mi imperdiet, elementum eleifend mi laoreet. Vestibulum molestie turpis non nibh elementum, sed ornare magna tristique. Aliquam erat volutpat. Phasellus volutpat mi vel tempor finibus.
</Text>

At runtime, how can I determine how many lines this Text component has rendered. This number will vary depending on device (eg. iPhone 5 will need to render more lines vs iPhone 6+ as it has a smaller screen size). I've checked the source code for the Text component but there doesn't seem to be anything I'm looking for.

I am using React Native 0.24.

Any ideas?

Cheers.


React Native android build failed. SDK location not found

$
0
0

I have error when i start running android

What went wrong:
A problem occurred evaluating project ':app'.  
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

Got this bug in React-Native I can't figure out

$
0
0

Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

xecution failed for task ':app:preDebugBuild'.
Android dependency 'com.google.android.gms:play-services-base' has different version for the compile (12.0.1) and runtime (17.0.0) classpath. You should manually set the same version via DependencyResolution

  • 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 1m 0s
18 actionable tasks: 1 executed, 17 up-to-date
Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html

I have searched high and low for the answer and there are some similar but none of the ways people got if fixed work for me! Please help, it would be much appreciated!

Let me know if you have any ideas or need me to explain or something.

Does the react javascript run time is guaranteed to be started when a service is started?

$
0
0

In my app the BroadcastReceiver receives the intent and starts the service by calling "context.startForegroundService(service)". Does this start the react javascript runtime ?

The android Application class docs says the Application class onCreate method is called before any service is stared https://developer.android.com/reference/android/app/Application.html#onCreate() .

Does this mean react javascript runtime is also started before the service onCreate method is called ?

The ReactApplication class is an interface with one method https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/ReactApplication.java. I could not find the react code that starts the javascript run time. If some one knows the source code that starts the javascript runtime please post the link. Thanks

Camera Preview in Expo is Distorted

$
0
0

I'm using Camera that comes from expo package and I'm having trouble with camera preview distortion. The preview makes images appear wider in landscape view and thinner in portrait view. I've tried to use a prepareRatio function to find the supported ratio of the current phone and then set the ratio prop to that ratio. However, this did not fix the distortion.

Relevant Code:

camera.page.js:

import React from 'react';
import { View, Text } from 'react-native';
import { Camera } from 'expo-camera';
import * as Permissions from 'expo-permissions'
import { Platform } from 'react-native';

import styles from './styles';
import Toolbar from './toolbar.component';

const DESIRED_RATIO = "18:9";

export default class CameraPage extends React.Component {
    camera = null;

    state = {
        hasCameraPermission: null,
    };

    async componentDidMount() {
        const camera = await Permissions.askAsync(Permissions.CAMERA);
        const audio = await Permissions.askAsync(Permissions.AUDIO_RECORDING);
        const hasCameraPermission = (camera.status === 'granted'&& audio.status === 'granted');

        this.setState({ hasCameraPermission });
    };
    prepareRatio = async () => {
        if (Platform.OS === 'android'&& this.cam) {
             const ratios = await this.cam.getSupportedRatiosAsync();

             // See if the current device has your desired ratio, otherwise get the maximum supported one
             // Usually the last element of "ratios" is the maximum supported ratio
             const ratio = ratios.find((ratio) => ratio === DESIRED_RATIO) || ratios[ratios.length - 1];

             this.setState({ ratio });
        }
    }
    render() {
        const { hasCameraPermission } = this.state;

        if (hasCameraPermission === null) {
            return <View />;
        } else if (hasCameraPermission === false) {
            return <Text>Access to camera has been denied.</Text>;
        }

        return (
          <React.Fragment>
            <View>
              <Camera
                ref={camera => this.camera = camera}
                onCameraReady={this.prepareRatio}
                ratio={this.state.ratio}
                style={styles.preview}
                />
            </View>
            <Toolbar/>
          </React.Fragment>

        );
    };
};

styles.js:

import { StyleSheet, Dimensions } from 'react-native';

const { width: winWidth, height: winHeight } = Dimensions.get('window');
export default StyleSheet.create({
    preview: {
        height: winHeight,
        width: winWidth,
        position: 'absolute',
        left: 0,
        top: 0,
        right: 0,
        bottom: 0,
        paddingBottom: 1000,
    },
    alignCenter: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    bottomToolbar: {
        width: winWidth,
        position: 'absolute',
        height: 100,
        bottom: 0,
    },
    captureBtn: {
        width: 60,
        height: 60,
        borderWidth: 2,
        borderRadius: 60,
        borderColor: "#FFFFFF",
    },
    captureBtnActive: {
        width: 80,
        height: 80,
    },
    captureBtnInternal: {
        width: 76,
        height: 76,
        borderWidth: 2,
        borderRadius: 76,
        backgroundColor: "red",
        borderColor: "transparent",
    },
});

Am I going about this problem incorrectly?

Is there a possibility to install mapbox navigation on react-native?

$
0
0

I am developing a react-native application using mapbox gl. I would like to use navigation turn by turn, but can't find a way to install sdk for react-native (only java from the mapbox website) Is there a way to have navigation turn by turn to use with mapbox gl?

For android actually (later for ios also)

Could not find com.android.tools.build:gradle:3.5

$
0
0

I'm trying to update gradle from 1.3.1 to 3.5, as some of my dependencies requires version 3.3 or above.

I've seen similar questions, but none of them help.

build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5'
    }
}

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

Still i'm getting this when trying to do anything (build, clean etc):

Building and installing the app on the device (cd android && ./gradlew installDebug...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'chat'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.5.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.jar
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

React native exception: The specified child already has a parent.

$
0
0

I'm getting the following error triggered by React Native. I'm pretty sure its linked to a custom view I am using.

The view is generated by some C++ code (via OpenGL) which is added to a ViewGroup and then incorporated into a React Native view. The first time the app loads, everything is fine. However, when some data changes, it seems that React wants to reload the view, and create a new instance of the view. I am checking if the view has a parent and if so, delete it, before returning the view. However, after the user selects new data, just as the views are about to update, the crash occurs.

The ViewManager code is as follows:

public class ReactJuceViewManager extends SimpleViewManager<JuceViewHolder> {

    public static final String REACT_CLASS = "ReactJuceView";
    private ReactApplicationContext reactContext;

    public ReactJuceViewManager(ReactApplicationContext reactContext)
    {
        super();
        this.reactContext = reactContext;
    }

    @Override
    public String getName()
    {
        return REACT_CLASS;
    }

    @Override
    protected JuceViewHolder createViewInstance(ThemedReactContext themedReactContext) {

        JuceBridge juceBridge = JuceBridge.getInstance(); 
        //JuceBridge manages the a HashMap of `JuceViewHolder`s, never deleting them once created

        Log.d("ReactJuceViewManager", "createViewInstance");
        JuceViewHolder v = juceBridge.getViewForComponent("Tuner", themedReactContext);

        Log.d("JuceViewHolder", v.getTag().toString());
        ViewGroup parent = (ViewGroup) v.getParent();
        if (parent != null)
        {
            Log.d("ReactJuceViewManager", "JuceViewHolder parent: " + v.getParent().toString());
            // Remove from parent
            Log.i("ReactJuceViewManager", "Removing JuceViewHolder instance from previous parent");
            parent.removeView(v);
        }
        else
        {
            Log.d("ReactJuceViewManager", "JuceViewHolder parent: null");
        }

        return v;
    }

}

.. and here is the stack trace:

E/unknown:React: Exception in native call from JS
                                                                       java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
                                                                           at android.view.ViewGroup.addViewInner(ViewGroup.java:4309)
                                                                           at android.view.ViewGroup.addView(ViewGroup.java:4145)
                                                                           at android.view.ViewGroup.addView(ViewGroup.java:4086)
                                                                           at com.facebook.react.views.view.ReactViewManager.addView(ReactViewManager.java:196)
                                                                           at com.facebook.react.views.view.ReactViewManager.addView(ReactViewManager.java:39)
                                                                           at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:384)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:175)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
                                                                           at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:868)
                                                                           at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
                                                                           at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
                                                                           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
                                                                           at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                           at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                                           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                           at android.os.Handler.handleCallback(Handler.java:739)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Edit AndroidManifest in un-ejected Expo App?

$
0
0

I've been building my RN app directly from Expo (expo build:ios/expo build:android) without ejecting, without opening the app in Xcode or Android Studio.

To get KeyboardAwareScrollView to work on Android I need to Set windowSoftInputMode to adjustPan in AndroidManifest.xml.

Is there a way I can do this without ejecting? (Keeping with my build-direct-from-expo workflow)

Ejecting has given me lots of errors in Xcode (fixable with a LOT of work), and I don't have any experience with Android development so I shudder to think what will happen when I open an ejected Android project.

First argument "email" must be a valid string

$
0
0

I'm recently practicing React Native and developing a signup form attached to Firebase.

But whenever I tried to click the button, it gives an error:

createUserWithEmailAndPassword failed first argument email must be a valid string.

This is my code:

import React, {Component} from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar,
} from 'react-native';

import {Button,Input} from 'react-native-elements';
import firebase from './screens/firebase';

console.log(firebase.name);
console.log(firebase.database());

class App extends React.Component
{

constructor(props)
{
  super(props);
  this.state = {
    name:'',
    email : '',
    Password : '',
    tc:'',
    phone:'',
    };
}

handleRegisterUser = () => {
    const {name,email,Password,tc,phone} =this.setState;
    firebase.auth().createUserWithEmailAndPassword(email,Password)
    .then((user) => {
        const fbRootRefFS = firebase.firestore();
        const userID = user.uid;
        const userRef = fbRootRefFS.collection('users')
        .doc(userID);
        userRef.set({
            name,
            email,
            Password,
            tc,
            phone,
        });
    })
    }
  render(){
    return(
      <View style = {styles.container}>

      <Input
        placeholder='Enter Name'
        onChangeText={(name) => this.setState({name})}/>

      <Input
        placeholder='Enter Email'
        onChangeText={(email) => this.setState({email})}/>

      <Input
        placeholder='Enter Password'
        onChangeText={(Password) => this.setState({Password})}/>

       <Input
        placeholder='Enter TC'
        onChangeText={(tc) => this.setState({tc})}/>

        <Input
         placeholder='Enter Phone'
         onChangeText={(phone) => this.setState({phone})}/>

    <View style={{marginTop : 40,flexDirection : 'row'}}>

     <Button
       title="Sign UP"
       onPress = {() => this.handleRegisterUser(this.state.name,this.state.email,this.state.Password,this.state.tc,this.state.phone)}/>
      </View>
     </View>
      );
  }
}

const styles = StyleSheet.create({
  container :
  {
    flex : 1,
    justifyContent : 'center',
    alignItems : 'center',
  }
});

export default App;

Where am I making a mistake? I have been dealing with this problem for a long time, thanks for your help.

How to integrate native ios camera SDK in existing react native App?

$
0
0

I am currently working with a react native app as per requirement i need to integrate external camera with ios and android SDK.

As react native SDK for particular camera is not available can anyone help me with any example how I can complete this task using iOS And Android SDK.

Camera should capture multiple images and video also so that I can post those with button press.

Thanks..!!

could not generate APK on react native : :app:lintVitalRelease

$
0
0

I create a key with this command :

keytool -genkey -v -keystore first-key.keystore -alias first-key-alias -keyalg RSA -keysize 2048 -validity 1000

and add this to gradle file :

signingConfigs {
        release {
            storeFile file('/home/mohamadreza/keys/first-key.keystore')
            storePassword '1234567890'
            keyAlias = 'first-key-alias'
            keyPassword 'qq-2012'
        }
    }
    buildTypes {
        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"
        }
    }

then I run this command:
cd android && ./gradlew assembleRelease

I got this error:

Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all task dependencies for configuration ':app:lintClassPath'.
   > Could not find com.android.tools.lint:lint-gradle:26.4.2.
     Searched in the following locations:
...

my classpath : classpath('com.android.tools.build:gradle:3.4.2')

how can I fix it?

React native Android App wont't build and displays the following error

$
0
0

PFA image for reference.

Screenshot Real Device

  • One Plus 6
  • Oxygen OS

My app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",
    bundleInRelease: true,
    enableHermes: true,
]

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

def enableSeparateBuildPerCPUArchitecture = true

def enableProguardInReleaseBuilds = true

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
    }

    lintOptions { 
        checkReleaseBuilds false
    }

    defaultConfig {
        applicationId "com.****.**"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 206
        versionName "2.1"
        multiDexEnabled true
        missingDimensionStrategy 'react-native-camera', 'general'

    }

    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 {            
            // minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
            // shrinkResources true
            zipAlignEnabled true
            useProguard enableProguardInReleaseBuilds
        }

        // 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) * 1048600 + defaultConfig.versionCode
                }
            }
        }
    }

    packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'        
    }

}

dependencies {
    implementation project(':react-native-splash-screen')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-gesture-handler')
    implementation project(':@react-native-community_netinfo')
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.annotation:annotation:1.0.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')   
    implementation 'com.facebook.react:react-native:+'
    implementation 'com.android.support:multidex:1.0.1'

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

    // From node_modules
    implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
    implementation 'com.google.android.gms:play-services-identity:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    // Firebase dependencies
    implementation project(':react-native-firebase')
    implementation "com.google.android.gms:play-services-base:17.0.0"

    implementation "com.google.firebase:firebase-core:17.0.0"
    implementation "com.google.firebase:firebase-messaging:19.0.0"

    implementation project(':@mauron85_react-native-background-geolocation')
    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'
   }

}

// 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)

My Top Level build.gradle file


buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "11+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        classpath 'com.google.gms:google-services:4.2.0'

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

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        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")
        }

    }
}

/*
To resolve the gradle dependency issue
*/
subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
            android {
            compileSdkVersion = 28
            buildToolsVersion = "28.0.3"
            }
        }
    }
}
subprojects {
  project.configurations.all {
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'&& !details.requested.name.contains('multidex') ) {
           details.useVersion "28.0.3"
        }
     }
  }
}

My package.json dependencies

"dependencies": {
    "@mauron85/react-native-background-geolocation": "^0.6.3",
    "@react-native-community/async-storage": "^1.5.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/netinfo": "^3.2.1",
    "@types/react-native-vector-icons": "^6.4.2",
    "@typescript-eslint/eslint-plugin": "^2.2.0",
    "@typescript-eslint/parser": "^2.2.0",
    "buffer": "^5.2.1",
    "d3-shape": "^1.3.5",
    "deepmerge": "^3.2.0",
    "lottie-react-native": "^3.1.0",
    "moment": "^2.24.0",
    "object-path": "^0.11.4",
    "prop-types": "^15.7.2",
    "query-string": "^6.5.0",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-android-location-services-dialog-box": "^2.8.2",
    "react-native-camera": "^3.0.0",
    "react-native-cli": "^2.0.1",
    "react-native-copilot": "^2.4.5",
    "react-native-datepicker": "^1.7.2",
    "react-native-device-info": "1.6.1",
    "react-native-document-picker": "^2.2.0",
    "react-native-elements": "^1.1.0",
    "react-native-exit-app": "^1.0.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-firebase": "~5.5.6",
    "react-native-fs": "^2.13.3",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-google-signin": "^2.0.0",
    "react-native-image-picker": "^0.28.0",
    "react-native-image-resizer": "^1.0.1",
    "react-native-image-zoom-viewer": "^2.2.25",
    "react-native-linear-gradient": "^2.5.4",
    "react-native-loader": "^1.2.1",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-maps": "^0.26.1",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-permissions": "^1.1.1",
    "react-native-picker-select": "^6.1.0",
    "react-native-privacy-snapshot": "^1.0.0",
    "react-native-qrcode-scanner": "^1.2.1",
    "react-native-shared-preferences": "^1.0.0",
    "react-native-simple-toast": "0.0.8",
    "react-native-snackbar": "^2.0.2",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^9.4.0",
    "react-native-user-defaults": "^0.1.5",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^5.12.1",
    "react-redux": "^5.0.6",
    "react-roka-components": "^1.0.1",
    "redux": "^3.0.0",
    "redux-devtools-extension": "^2.13.8",
    "redux-form": "^7.4.2",
    "url": "^0.11.0",
    "url-parse": "^1.4.7",
    "uuid": "^3.3.2",
    "whatwg-fetch": "^2.0.4"
  },

Steps taken to resolve :

1) Tried using the same version of dependencies (17.0.0) for "com.google.firebase:firebase-core" and "com.google.firebase:firebase-messaging" as suggested in the below link.

No class Def Error

But the gradle build failed with the following error

CONFIGURE FAILED in 1m 0s In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.0.0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.firebase:firebase-messaging:17.0.0 -> com.google.firebase:firebase-iid@[16.0.0], but firebase-iid version was 19.0.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the artifact with the issue.

-- Project 'app' depends onto com.google.firebase:firebase-messaging@{strictly 17.0.0}

-- Project 'app' depends onto com.google.firebase:firebase-iid@{strictly 19.0.0}

com.facebook.react.bridge.WritableMap.copy() on a null object reference

$
0
0

I have a background service on my app wrote with react-native. When start service then closed app and alert: "Stoped: Unfortunately". I open project on android studio for test and debug. and i take it problem.

My react-native version: 0.0.1 and my package json like that;


{
  "name": "kimdeyizApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "lint": "eslint",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-axios": "^0.17.1",
    "react-native-elements": "^1.2.6",
    "react-native-push-notification": "^3.1.9",
    "react-native-router-flux": "^4.0.6",
    "react-redux": "^7.0.3",
    "redux": "^4.0.1",
    "redux-actions": "^2.6.5",
    "socket.io-client": "^2.3.0",
    "watchman": "^1.0.0"
  },
  "devDependencies": {
    "@babel/core": "7.6.4",
    "@babel/runtime": "7.6.3",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.9.0",
    "eslint": "6.5.1",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-import": "^2.17.2",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-react": "^7.13.0",
    "jest": "24.9.0",
    "jetifier": "^1.6.4",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

HeadlessJsTaskConfig.java

package com.facebook.react.jstasks;
import com.facebook.react.bridge.WritableMap;
public class HeadlessJsTaskConfig {
  private final String mTaskKey;
  private final WritableMap mData;
  private final long mTimeout;
  private final boolean mAllowedInForeground;
  private final HeadlessJsTaskRetryPolicy mRetryPolicy;
  public HeadlessJsTaskConfig(String taskKey, WritableMap data) {
    this(taskKey, data, 0, false);
  }
  public HeadlessJsTaskConfig(String taskKey, WritableMap data, long timeout){
    this(taskKey, data, timeout, false);
  }
  public HeadlessJsTaskConfig(
      String taskKey, WritableMap data, long timeout, boolean allowedInForeground) {
    this(taskKey, data, timeout, allowedInForeground, NoRetryPolicy.INSTANCE);
  }
  public HeadlessJsTaskConfig(
      String taskKey,
      WritableMap data,
      long timeout,
      boolean allowedInForeground,
      HeadlessJsTaskRetryPolicy retryPolicy) {
    mTaskKey = taskKey;
    mData = data;
    mTimeout = timeout;
    mAllowedInForeground = allowedInForeground;
    mRetryPolicy = retryPolicy;
  }

  public HeadlessJsTaskConfig(HeadlessJsTaskConfig source) {
    mTaskKey = source.mTaskKey;
    mData = source.mData.copy();
    mTimeout = source.mTimeout;
    mAllowedInForeground = source.mAllowedInForeground;

    final HeadlessJsTaskRetryPolicy retryPolicy = source.mRetryPolicy;
    if (retryPolicy != null) {
      mRetryPolicy = retryPolicy.copy();
    } else {
      mRetryPolicy = null;
    }
  }

  String getTaskKey() {
    return mTaskKey;
  }

  WritableMap getData() {
    return mData;
  }

  long getTimeout() {
    return mTimeout;
  }

  boolean isAllowedInForeground() {
    return mAllowedInForeground;
  }

   HeadlessJsTaskRetryPolicy getRetryPolicy() {
    return mRetryPolicy;
  }

}

and my error;

  --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.kimdeyizapp, PID: 8514
    java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.bridge.WritableMap com.facebook.react.bridge.WritableMap.copy()' on a null object reference
        at com.facebook.react.jstasks.HeadlessJsTaskConfig.<init>(HeadlessJsTaskConfig.java:88)
        at com.facebook.react.jstasks.HeadlessJsTaskContext.startTask(HeadlessJsTaskContext.java:106)
        at com.facebook.react.jstasks.HeadlessJsTaskContext.startTask(HeadlessJsTaskContext.java:84)
        at com.facebook.react.HeadlessJsTaskService$2.run(HeadlessJsTaskService.java:123)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 8514 SIG: 9
Process 8514 terminated.

So other a problem is like that.

E/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.kimdeyizapp/app_webview/variations_seed": /data/user/0/com.kimdeyizapp/app_webview/variations_seed (No such file or directory)

Thanks for helps.

LocalNotificationSchedule not working on android react native v0.60

$
0
0

localNotificationSchedule is not working react-native-push-notification while localNotification is working normally:

PushNotification.localNotificationSchedule({
    message: "Notification",
    date: new Date(Date.now() + 60 * 1000),
    id: "1"
  });

"react-native": "0.60.5",

"react-native-push-notification": "^3.1.1"

updating AndroidManifest as intended in https://github.com/zo0r/react-native-push-notification,

any help what should be done to display notification using localNotificationSchedule()


react-native android bundle release fails to run on some devices

$
0
0

I am working on a mobile application and developing it using react-native.I can successfully run the project on my emulator via

react-native run-android 

and i can successfully have a bundle release with the command

./gradlew bundleRelease

And i can even successfully upload my app to the Google Play Store. The problem is that some devices won't be able to install the app.It will fail.

After searching on the internet i figured out that the problem was variety of different cpu architectures on different devices (as far as i understood).And my emulator is using a 32 bit cpu (x86) and the build runs successfully on my emulator.

I don't own an Android device so the best way i have found to debug the error was to use Firebase's "Test Lab" and observe the output.

I believe there is another problem other than cpu architecture, which is the Hermes.I am disabling the hermes in my app/build.gradle however when i release a bundle and test it on Firebase Test Lab the application will fail and give me this output;

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
     FATAL EXCEPTION: create_react_context
Process: com.lockerapp, PID: 18180
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
    at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
    at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
    at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
    at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
    at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
    at java.lang.Thread.run(Thread.java:764)

Here is my environment;

System:
    OS: macOS 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
    Memory: 242.76 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.9.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.10.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 25, 26, 27, 28, 29
      Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    create-react-native-app: 2.0.2
    react-native-cli: 2.0.1

And here is my app/build.gralde;

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 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.lockerapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 11
        versionName "1.1.5"
    }
    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'
        }
    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 {
        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.release
        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
            }

        }
    }

    packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugİmplementation files(hermesPath + "hermes-debug.aar")
      releaseİmplementation 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 from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I am struggling with releasing a bundle for as many devices as possible and publishing to the Google Play Store.I don't really care about using hermes or not as far as my build succeeds and runs on all possible devices.

Is there a known guide that i might have missed to release a bundle for all cpu architectures and avoids the errors with hermes? Any answer is appreciated, thanks.

UPDATE:

After a lot of research i still couldn't find a solution for this, however i found a work around for the problem, instead of creating an .aab file with

./gradlew bundleRelase 

i am creating a universal APK file with the command;

./gradlew assembleRelease

The generated .apk file is accepted by google play store and i have passed the tests on Firebase Test Lab, also works on 32bit and 64bit local android emulators, the down side is of course my download size increased (from around 8mb to 15mb) but still it is a solution for a while.

react-native : can't push to git because of hprof file

$
0
0

I would like to push my project into the github, however i just notice there is a file called java_pid14920.hprof inside the android folder and cause around 300MB

remote: error: File android/java_pid14920.hprof is 301.75 MB; this exceeds GitHub's file size limit of 100.00 MB

I wonder it is safe to delete this file ?

react-native run-android keeps failing. What am I doing wrong?

$
0
0

I setup a react native environment and created a new project using react native cli. But it fails when I run react-native run-android

This is what I get in my terminal. Can anyone please help?

PS C:\Users\Mahali\Documents\Work\Code\Project> npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 864 file(s) to forward-jetify. Using 8 workers... info Starting JS server...

info Installing the app...

[Fatal Error] versionedparcelable-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] lifecycle-runtime-2.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] documentfile-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] localbroadcastmanager-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] print-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] loader-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] legacy-support-core-ui-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] lifecycle-viewmodel-2.0.0.pom:2:1: Content is not allowed in prolog. FAILURE: Build failed with an exception. * What went wrong:

Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not resolve androidx.lifecycle:lifecycle-runtime:2.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.core:core:1.0.1

> Could not resolve androidx.lifecycle:lifecycle-runtime:2.0.0.

> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-runtime/2.0.0/lifecycle-runtime-2.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.core:core:1.0.1

> Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/versionedparcelable/versionedparcelable/1.0.0/versionedparcelable-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.documentfile:documentfile:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.documentfile:documentfile:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/documentfile/documentfile/1.0.0/documentfile-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.loader:loader:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0
> Could not resolve androidx.loader:loader:1.0.0.

> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/loader/loader/1.0.0/loader-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.localbroadcastmanager:localbroadcastmanager:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.localbroadcastmanager:localbroadcastmanager:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/localbroadcastmanager/localbroadcastmanager/1.0.0/localbroadcastmanager-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.print:print:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.print:print:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/print/print/1.0.0/print-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.legacy:legacy-support-core-ui:1.0.0. Required by: project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0 project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.vectordrawable:vectordrawable-animated:1.0.0 > Could not resolve androidx.legacy:legacy-support-core-ui:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/legacy/legacy-support-core-ui/1.0.0/legacy-support-core-ui-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.lifecycle:lifecycle-viewmodel:2.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0
> Could not resolve androidx.lifecycle:lifecycle-viewmodel:2.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-viewmodel/2.0.0/lifecycle-viewmodel-2.0.0.pom> Content is not allowed in prolog. * Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.orgBUILD FAILED in 14s 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.bat app:installDebug -PreactNativeDevServerPort=8081

[Fatal Error] versionedparcelable-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] lifecycle-runtime-2.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] documentfile-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] localbroadcastmanager-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] print-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] loader-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] legacy-support-core-ui-1.0.0.pom:2:1: Content is not allowed in prolog. [Fatal Error] lifecycle-viewmodel-2.0.0.pom:2:1: Content is not allowed in prolog. FAILURE: Build failed with an exception. * What went wrong:

Could not determine the dependencies of task ':app:mergeDebugAssets'.

> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not resolve androidx.lifecycle:lifecycle-runtime:2.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.core:core:1.0.1

> Could not resolve androidx.lifecycle:lifecycle-runtime:2.0.0.

> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-runtime/2.0.0/lifecycle-runtime-2.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.core:core:1.0.1

> Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/versionedparcelable/versionedparcelable/1.0.0/versionedparcelable-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.documentfile:documentfile:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.documentfile:documentfile:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/documentfile/documentfile/1.0.0/documentfile-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.loader:loader:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0
> Could not resolve androidx.loader:loader:1.0.0.

> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/loader/loader/1.0.0/loader-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.localbroadcastmanager:localbroadcastmanager:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.localbroadcastmanager:localbroadcastmanager:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/localbroadcastmanager/localbroadcastmanager/1.0.0/localbroadcastmanager-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.print:print:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.legacy:legacy-support-core-utils:1.0.0 > Could not resolve androidx.print:print:1.0.0.

> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/print/print/1.0.0/print-1.0.0.pom> Content is not allowed in prolog.

> Could not resolve androidx.legacy:legacy-support-core-ui:1.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0 project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.vectordrawable:vectordrawable-animated:1.0.0 > Could not resolve androidx.legacy:legacy-support-core-ui:1.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/legacy/legacy-support-core-ui/1.0.0/legacy-support-core-ui-1.0.0.pom> Content is not allowed in prolog. > Could not resolve androidx.lifecycle:lifecycle-viewmodel:2.0.0. Required by:

project :app > com.facebook.react:react-native:0.61.3 > androidx.appcompat:appcompat:1.0.2 > androidx.fragment:fragment:1.0.0
> Could not resolve androidx.lifecycle:lifecycle-viewmodel:2.0.0. > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-viewmodel/2.0.0/lifecycle-viewmodel-2.0.0.pom> Content is not allowed in prolog. * Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.orgBUILD FAILED in 14s at checkExecSyncError (child_process.js:603:11)

at execFileSync (child_process.js:621:15)

at runOnAllDevices (C:\Users\Mahali\Documents\Work\Code\Project\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39) at buildAndRun (C:\Users\Mahali\Documents\Work\Code\Project\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41) at C:\Users\Mahali\Documents\Work\Code\Project\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12 at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Command.handleAction (C:\Users\Mahali\Documents\Work\Code\Project\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)

Share custom file using React Native

$
0
0

I have a custom file something like file.myext wich I create it using rn-fetch-blob:

RNFetchBlob.fs.writeFile(path, JSON.stringify(data), 'utf8')

And I'm using react-native-share to share the file, I tried both:

Share.open({type: 'text/plain', url: 'file://'+path})

and

RNFetchBlob.fs.readFile(path, 'base64')
.then((data) => {
   Share.open({url: 'data:text/plain;base64,'+data})
})

but doesn't work, the second one share .txt file.

anyway to solve this?

Android Calendar API set ACL on Calendar

$
0
0

I have a react-native app which uses react-native-calendar-events to read calendar events. This works nicely.

But I also have the requirement of sharing the user's calendar with other people (using their gmail account).

react-native-calendar-events doesn't do this. It looks like Calendar Provider doesn't do this either.

So it looks like I'm forced to use Rest Calendar API. Please correct me if I'm wrong.

My questions are:

  • Am I stuck with creating a Google Application to which my users will have to give permission to read and manage their calendar?
  • Am I stuck with managing a user's calendar permissions from the server if I don't want to share the Google App client id & secret with the React Native App?
Viewing all 29504 articles
Browse latest View live


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