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

react native firebase phone auth not works after generating signed APK

$
0
0

I build react native app with firebase phone authafter I generated signed apk in android by

cd android && ./gradlew assembleRelease

I tested on my phone with the apk I generated and when I enter my phone nothing happened and it return my error

Error: this app is not authorized to use firebase authentication. please verifythat the correct package name and sha-1 are configured in the firebase console.

BUTwhen I run the app without the apk, with

react-native run-android

and the authentication works good and I register user.

 confirmPhone = async (phoneNumber) => {        const phoneWithAreaCode = phoneNumber.replace(/^0+/,'+972');        return new Promise((res, rej) => {            firebase.auth().verifyPhoneNumber(phoneWithAreaCode)                .on('state_changed', async (phoneAuthSnapshot) => {                    console.log('phone-->',phoneAuthSnapshot)                    switch (phoneAuthSnapshot.state) {                    case firebase.auth.PhoneAuthState.AUTO_VERIFIED:                        await this.confirmCode(phoneAuthSnapshot.verificationId, phoneAuthSnapshot.code, phoneAuthSnapshot)                        res(phoneAuthSnapshot)                        break                    case firebase.auth.PhoneAuthState.CODE_SENT:                        UserStore.setVerificationId(phoneAuthSnapshot.verificationId)                        res(phoneAuthSnapshot)                        break                    case firebase.auth.PhoneAuthState.AUTO_VERIFY_TIMEOUT:                         UserStore.setVerificationId(phoneAuthSnapshot.verificationId)                        UserStore.setErrorCodeAuthentication('SMS code has expired')                        res(phoneAuthSnapshot)                    case firebase.auth.PhoneAuthState.ERROR:                        // console.log(phoneAuthSnapshot)                        // if(NavigationStore.CurrentRoute == 'Login'){                        //     UserStore.setErrorCodeAuthentication('Please enter valid phone number')                        // }else                        //     UserStore.setErrorCodeAuthentication('Pin code invalid')                        rej(phoneAuthSnapshot)                        break                    }                })        })    }    confirmCode = async (verificationId, code, phoneAuthSnapshot) => {           try{            const credential = await firebase.auth.PhoneAuthProvider.credential(UserStore.verificationId, code)            UserStore.setCodeInput(code)            UserStore.setUserCredentials(credential)            AppStore.setAlreadyRegister(true)            await this.authenticate(credential)            return credential           } catch(e){               throw new Error(e)           }    }    authenticate = async (credential) => {         await firebase.auth().signInAndRetrieveDataWithCredential(credential)    }`

Export Excel in the customised format React Native?

$
0
0

I am trying to create an excel sheet from React Native mobile application. I have tried using xlsx to generate excel. But it is not supporting the styling excel sheet. Is it possible to use ExcelJS in React Native?

How to Customised this type Excel sheet in React-Native, I have data in JSON format.

if it is possible then how to do or suggest any alternateenter image description here

Are there any references to create CRUD mobile app using react native 0.6? I tried many

$
0
0

I am new to React-Native for mobile apps. I am looking for references to create CRUD mobile app. I tried many github references and youtube tutorials but they did not work out.

React native Receive notification but not show pop-up in android

$
0
0

AndroidManifest.xmlThis is My android manifest file, notifications comes properly but not showing popup like other applications. Application is in foreground sate or background state popup is not showing notifications are show in notification tray only.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.pushnotificationexample"><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.VIBRATE" /><uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><application    android:name=".MainApplication"    android:label="@string/app_name"    android:icon="@mipmap/ic_launcher"    android:roundIcon="@mipmap/ic_launcher_round"    android:allowBackup="false"    android:theme="@style/AppTheme"><activity        android:name=".MainActivity"        android:label="@string/app_name"        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"        android:launchMode="singleTask"        android:windowSoftInputMode="adjustResize"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity><activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /><!--        <meta-data android:name="com.dieam.reactnativepushnotification.channel_create_default" android:value="true"/>--><!-- Change the value to true to enable pop-up for in foreground on receiving remote notifications (for prevent duplicating while showing local notifications set this to false) --><meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"            android:value="true"/><!-- Change the resource name to your App's accent color - or any other color you want --><meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"            android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color --><receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" /><receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" /><receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver"><intent-filter><action android:name="android.intent.action.BOOT_COMPLETED" /><action android:name="android.intent.action.QUICKBOOT_POWERON" /><action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/></intent-filter></receiver><service            android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"            android:exported="false" ><intent-filter><action android:name="com.google.firebase.MESSAGING_EVENT" /></intent-filter></service></application></manifest>

Charging a subscription with Expo React Native

$
0
0

I've finally finished building my app with Expo/React Native (managed workflow), only to realize they don't support IAP (in-app purchases yet).

I need to charge a monthly subscription for premium features.

Because I currently don't own a Mac nor know how to build apps for iOS, its impossible for me to eject and build Android & iOS individually.

Is there any way I can charge for a monthly subscription outside the Play Store and App Store?

I guess the App Store is quite strict with this topic, but maybe the Play Store doesn't care too much if I redirect users to an external website?

Thanks a lot.

How can I use custom sounds for react native local notifications?

$
0
0

guys, I am trying to build an alarm app in React-Native where I can set custom sound for my alarm each time I set, that is sound from the device. Most of the options I found out was to use react native push notifications and alarm notifications npm libraries. They do allow using custom sounds but each time we need to dump those files in res/raw of the App folder. Can those node_modules be customised for my use case?

React Native 0.57.1 Android Duplicate Resources

$
0
0

When running ./android/gradlew assembleRelease I get the following error:

```* What went wrong:Execution failed for task ':app:mergeReleaseResources'.

[drawable-xhdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigation_src_views_assets_backicon.png [drawable-xhdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-xhdpi/node_modules_reactnavigation_src_views_assets_backicon.png: Error: Duplicate resources [drawable-xxhdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnavigation_src_views_assets_backicon.png [drawable-xxhdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-xxhdpi/node_modules_reactnavigation_src_views_assets_backicon.png: Error: Duplicate resources [drawable-hdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-hdpi/node_modules_reactnavigation_src_views_assets_backicon.png [drawable-hdpi-v4/node_modules_reactnavigation_src_views_assets_backicon] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-hdpi/node_modules_reactnavigation_src_views_assets_backicon.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_trophies_cookoo30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_marilyn_monroe_trophies_cookoo30x.png [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_trophies_cookoo30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_marilyn_monroe_trophies_cookoo30x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_5.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_5.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_coins_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_coins_5.png [drawable-mdpi-v4/app_assets_images_coins_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_coins_5.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_emotions_blinking_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_marilyn_monroe_emotions_blinking_2.png [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_emotions_blinking_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_marilyn_monroe_emotions_blinking_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_4.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_4.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_happy_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_happy_2.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_happy_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_happy_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_unlockablecharacters] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_unlockablecharacters.png [drawable-mdpi-v4/app_assets_images_unlockablecharacters] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_unlockablecharacters.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_6.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_6.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_trophies_cookoo3x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_marilyn_monroe_trophies_cookoo3x.png [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_trophies_cookoo3x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_marilyn_monroe_trophies_cookoo3x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_happy_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_happy_3.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_happy_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_happy_3.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_5.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_5.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_emotions_blinking_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_marilyn_monroe_emotions_blinking_3.png [drawable-mdpi-v4/app_assets_images_characters_marilyn_monroe_emotions_blinking_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_marilyn_monroe_emotions_blinking_3.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_coinsmodal_mostpopularlabel] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_coinsmodal_mostpopularlabel.png [drawable-mdpi-v4/app_assets_images_coinsmodal_mostpopularlabel] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_coinsmodal_mostpopularlabel.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_4.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_4.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_coins_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_coins_4.png [drawable-mdpi-v4/app_assets_images_coins_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_coins_4.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_napoleon_trophies_cookoo30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_napoleon_trophies_cookoo30x.png [drawable-mdpi-v4/app_assets_images_characters_napoleon_trophies_cookoo30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_napoleon_trophies_cookoo30x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_earthbg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_earthbg.png [drawable-mdpi-v4/app_assets_images_earthbg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_earthbg.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_happy_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_emotions_happy_6.png [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_happy_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_emotions_happy_6.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry10x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_trophies_angry10x.png [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry10x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_trophies_angry10x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_trophies_3conversations] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_trophies_3conversations.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_trophies_3conversations] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_trophies_3conversations.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_napoleon_trophies_cookoo10x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_napoleon_trophies_cookoo10x.png [drawable-mdpi-v4/app_assets_images_characters_napoleon_trophies_cookoo10x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_napoleon_trophies_cookoo10x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_angry_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_emotions_angry_2.png [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_angry_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_emotions_angry_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_napoleon_profile] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_napoleon_profile.png [drawable-mdpi-v4/app_assets_images_characters_napoleon_profile] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_napoleon_profile.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_happy_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_emotions_happy_4.png [drawable-mdpi-v4/app_assets_images_characters_einee_emotions_happy_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_emotions_happy_4.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_trophies_angry30x.png [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry30x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_trophies_angry30x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_coins_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_coins_6.png [drawable-mdpi-v4/app_assets_images_coins_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_coins_6.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_6.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_blinking_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_blinking_6.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_bg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_bg.jpg [drawable-mdpi-v4/app_assets_images_characters_einee_bg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_bg.jpg: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_cookoo_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_cookoo_2.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_cookoo_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_cookoo_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_3.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_3.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_4.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_4] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_4.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_angry_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_angry_2.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_angry_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_angry_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_trophies_allconversations1x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_trophies_allconversations1x.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_trophies_allconversations1x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_trophies_allconversations1x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_coinsmodal_coins500] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_coinsmodal_coins500.png [drawable-mdpi-v4/app_assets_images_coinsmodal_coins500] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_coinsmodal_coins500.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_angry_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_angry_3.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_angry_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_angry_3.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_5.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_happy_5] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_happy_5.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_2.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_2] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_blinking_2.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_cookoo_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_cookoo_3.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_emotions_cookoo_3] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_emotions_cookoo_3.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry100x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_einee_trophies_angry100x.png [drawable-mdpi-v4/app_assets_images_characters_einee_trophies_angry100x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_einee_trophies_angry100x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_donald_trump_bg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_donald_trump_bg.jpg [drawable-mdpi-v4/app_assets_images_characters_donald_trump_bg] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_donald_trump_bg.jpg: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_cleopatra_trophies_allconversations3x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_cleopatra_trophies_allconversations3x.png [drawable-mdpi-v4/app_assets_images_characters_cleopatra_trophies_allconversations3x] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_cleopatra_trophies_allconversations3x.png: Error: Duplicate resources [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/src/main/res/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_6.png [drawable-mdpi-v4/app_assets_images_characters_leonardo_da_vinci_emotions_angry_6] /Users/Ilyakar/Documents/Business/Development/My_Projects/new/Einee/App/android/app/build/generated/res/react/release/drawable-mdpi/app_assets_images_characters_leonardo_da_vinci_emotions_angry_6.png: Error: Duplicate resources ```

I already tried the following from the answers I found on React Native Duplicate resources with zero success:

Attempt #1:

"Deleting the drawables with rm -rf android/app/src/main/res/drawable-* and generating APK on Android Studio worked for me."

Attempt #2:

"rm -rf android/app/src/main/res/drawable-*

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

And compile android again react-native run-android"


Any other ideas?

Execution failed for task ':app:multiDexListDebug'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

$
0
0

I'm new to react native . when I run the react native via physical I got this error . And I tired to cleaned gradle and clean the npm still same error.

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:multiDexListDebug'.> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade> Java heap space* 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 4m 37s

what's going wrong with is.


React Native Release( IPA and APK ) crash on start

$
0
0

Iam getting the below error when I open the release build .It happens both in IOS and Android.

E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modulesProcess: com.package.name, PID: 28695com.facebook.react.common.JavascriptException: ReferenceError: Can't find variable: typeAnnotation, stack:@980:17088v@2:1473@979:425v@2:1473@978:339v@2:1473@971:6338v@2:1473@970:139v@2:1473@969:218v@2:1473@968:117v@2:1473@882:1330v@2:1473@545:542v@2:1473@406:344v@2:1473@6:57v@2:1473d@2:875global code@1766:3at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:83)at java.lang.reflect.Method.invoke(Native Method)at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)at android.os.Handler.handleCallback(Handler.java:789)at android.os.Handler.dispatchMessage(Handler.java:98)at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)at android.os.Looper.loop(Looper.java:164)at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)at java.lang.Thread.run(Thread.java:764)

Project Information

System:OS: macOS 11.0.1CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHzMemory: 111.48 MB / 16.00 GBShell: 5.8 - /bin/zsh Binaries:Node: 10.16.3 - /usr/local/bin/nodeYarn: 1.22.5 - /usr/local/bin/yarnnpm: 6.14.10 - /usr/local/bin/npmWatchman: 4.9.0 - /usr/local/bin/watchmanManagers:CocoaPods: 1.9.3 - /usr/local/bin/podSDKs: iOS SDK:  Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1 Android SDK:   API Levels: 23, 24, 25, 26, 27, 28, 29  Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.3  System Images: android-26 | Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom  Android NDK: Not FoundIDEs:Android Studio: 4.1 AI-201.8743.12.41.6953283Xcode: 12.2/12B45b - /usr/bin/xcodebuildLanguages:Java: 1.8.0_221 - /usr/bin/javacPython: 2.7.16 - /usr/bin/pythonnpmPackages:@react-native-community/cli: Not Foundreact: 16.13.1 => 16.13.1 react-native: ^0.63.3 => 0.63.4 react-native-macos: Not FoundnpmGlobalPackages:*react-native*: Not Found

Package.json

  {"name": "AwrStarterKit","version": "0.0.1","private": true,"scripts": {"android": "react-native run-android","ios": "react-native run-ios","start": "react-native start","test": "jest","lint": "eslint .","ios-build:dev": "gulp set --env=dev && react-native run-ios","ios-build:test": "gulp set --env=test && react-native run-ios","ios-build:prod": "gulp set --env=prod && react-native run-ios","android-build:dev": "gulp set --env=dev && react-native run-android","android-build:test": "gulp set --env=test && react-native run-android","android-build:prod": "gulp set --env=test && react-native run-android","android-releaseBuild:test": "gulp set --env=test && cd android && ./gradlew assembleRelease","android-releaseBuild:prod": "gulp set --env=test && cd android && ./gradlew clean && ./gradlew assembleRelease","android-clean": "cd android && ./gradlew clean","generate": "plop"  },"dependencies": {"@notifee/react-native": "^0.13.2","@react-native-community/async-storage": "^1.12.0","@react-native-community/geolocation": "^2.0.2","@react-native-community/masked-view": "^0.1.10","@react-native-community/netinfo": "^5.9.7","@react-native-community/toolbar-android": "^0.1.0-rc.2","@react-native-firebase/analytics": "^7.6.7","@react-native-firebase/app": "^8.4.3","@react-native-firebase/crashlytics": "^8.4.9","@react-native-firebase/messaging": "^7.8.11","@react-navigation/bottom-tabs": "^5.9.0","@react-navigation/compat": "^5.2.8","@react-navigation/native": "^5.7.4","@react-navigation/stack": "^5.9.1","axios": "^0.20.0","firebase": "^7.22.0","fs": "^0.0.1-security","gulp": "^4.0.2","gulp-clean": "^0.4.0","gulp-rename": "^2.0.0","i18n-js": "^3.7.1","js-base64": "^3.5.2","js-pascalcase": "^1.2.1","lodash.memoize": "^4.1.2","moment": "^2.29.1","plop": "^2.7.4","react": "16.13.1","react-native": "^0.63.3","react-native-af-video-player": "^0.2.1","react-native-android-location-enabler": "^1.2.1","react-native-aws3": "^0.0.9","react-native-calendar-events": "^2.1.0","react-native-camera": "^3.40.0","react-native-config": "^1.3.3","react-native-dash": "^0.0.11","react-native-datepicker": "^1.7.2","react-native-device-info": "^6.1.0","react-native-event-listeners": "^1.0.7","react-native-exception-handler": "^2.10.8","react-native-fast-image": "^8.3.3","react-native-fs": "^2.16.6","react-native-gesture-handler": "^1.9.0","react-native-google-places-autocomplete": "^1.9.0","react-native-highlight-words": "^1.0.1","react-native-hyperlink": "^0.0.19","react-native-i18n": "^2.0.15","react-native-image-crop-picker": "^0.35.0","react-native-image-gallery": "^2.1.5","react-native-image-pan-zoom": "^2.1.12","react-native-image-picker": "^2.3.4","react-native-keep-awake": "^4.0.0","react-native-linear-gradient": "^2.5.6","react-native-localize": "^1.4.1","react-native-map-link": "^2.7.19","react-native-maps": "^0.27.1","react-native-modal": "^11.5.6","react-native-mov-to-mp4": "^0.2.2","react-native-orientation": "^3.1.3","react-native-pdf": "^6.2.1","react-native-permissions": "^2.2.2","react-native-photo-view-ex": "^1.1.0","react-native-progress": "^4.1.2","react-native-reanimated": "^1.13.2","react-native-render-html": "^4.2.4","react-native-restart": "^0.0.17","react-native-safe-area-context": "^3.1.9","react-native-screens": "^2.16.1","react-native-splash-screen": "^3.2.0","react-native-swiper": "^1.6.0","react-native-thumbnail": "^1.1.3","react-native-touch-id": "^4.4.1","react-native-vector-icons": "^7.1.0","react-native-version-number": "^0.3.6","react-native-video": "^5.1.0-alpha8","react-native-view-overflow": "^0.0.5","react-native-webview": "^10.9.0","react-navigation": "^4.4.1","react-navigation-transitions": "^1.0.12","react-redux": "^7.2.1","redux": "^4.0.5","redux-logger": "^3.0.6","redux-persist": "^6.0.0","redux-promise-middleware": "^6.1.2","redux-thunk": "^2.3.0","rn-fetch-blob": "^0.12.0","stacktrace-js": "^2.0.2"  },"devDependencies": {"@babel/core": "^7.8.4","@babel/runtime": "^7.8.4","@react-native-community/eslint-config": "^1.1.0","babel-jest": "^25.1.0","eslint": "^6.5.1","jest": "^25.1.0","metro-react-native-babel-preset": "^0.59.0","react-test-renderer": "16.13.1"  },"jest": {"preset": "react-native"  },"react-native": {"zlib": "browserify-zlib","console": "console-browserify","constants": "constants-browserify","crypto": "react-native-crypto","dns": "dns.js","net": "react-native-tcp","domain": "domain-browser","http": "@tradle/react-native-http","https": "https-browserify","os": "react-native-os","path": "path-browserify","querystring": "querystring-es3","fs": "react-native-level-fs","_stream_transform": "readable-stream/transform","_stream_readable": "readable-stream/readable","_stream_writable": "readable-stream/writable","_stream_duplex": "readable-stream/duplex","_stream_passthrough": "readable-stream/passthrough","dgram": "react-native-udp","stream": "stream-browserify","timers": "timers-browserify","tty": "tty-browserify","vm": "vm-browserify","tls": false  },"browser": {"zlib": "browserify-zlib","console": "console-browserify","constants": "constants-browserify","crypto": "react-native-crypto","dns": "dns.js","net": "react-native-tcp","domain": "domain-browser","http": "@tradle/react-native-http","https": "https-browserify","os": "react-native-os","path": "path-browserify","querystring": "querystring-es3","fs": "react-native-level-fs","_stream_transform": "readable-stream/transform","_stream_readable": "readable-stream/readable","_stream_writable": "readable-stream/writable","_stream_duplex": "readable-stream/duplex","_stream_passthrough": "readable-stream/passthrough","dgram": "react-native-udp","stream": "stream-browserify","timers": "timers-browserify","tty": "tty-browserify","vm": "vm-browserify","tls": false  }}

Build Gradle

app/build.gradle

apply plugin: "com.android.application"import com.android.build.OutputFile/** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ *   // the name of the generated asset file containing your JS bundle *   bundleAssetName: "index.android.bundle", * *   // the entry file for bundle generation. If none specified and *   // "index.android.js" exists, it will be used. Otherwise "index.js" is *   // default. Can be overridden with ENTRY_FILE environment variable. *   entryFile: "index.android.js", * *   // https://reactnative.dev/docs/performance#enable-the-ram-format *   bundleCommand: "ram-bundle", * *   // whether to bundle JS and assets in debug mode *   bundleInDebug: false, * *   // whether to bundle JS and assets in release mode *   bundleInRelease: true, * *   // whether to bundle JS and assets in another build variant (if configured). *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants *   // The configuration property can be in the following formats *   //         'bundleIn${productFlavor}${buildType}' *   //         'bundleIn${buildType}' *   // bundleInFreeDebug: true, *   // bundleInPaidRelease: true, *   // bundleInBeta: true, * *   // whether to disable dev mode in custom build variants (by default only disabled in release) *   // for example: to disable dev mode in the staging build type (if configured) *   devDisabledInStaging: true, *   // The configuration property can be in the following formats *   //         'devDisabledIn${productFlavor}${buildType}' *   //         'devDisabledIn${buildType}' * *   // the root of your project, i.e. where "package.json" lives *   root: "../../", * *   // where to put the JS bundle asset in debug mode *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * *   // where to put the JS bundle asset in release mode *   jsBundleDirRelease: "$buildDir/intermediates/assets/release", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in debug mode *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in release mode *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to *   // date; if you have any other folders that you want to ignore for performance reasons (gradle *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ *   // for example, you might want to remove it from here. *   inputExcludes: ["android/**", "ios/**"], * *   // override which node gets called and with what additional arguments *   nodeExecutableAndArgs: ["node"], * *   // supply additional arguments to the packager *   extraPackagerArgs: [] * ] */project.ext.react = [    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"apply from: project(':react-native-config').projectDir.getPath() +"/dotenv.gradle"/** * Set this to true to create two separate APKs instead of one: *   - An APK that only works on ARM devices *   - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */def enableSeparateBuildPerCPUArchitecture = false/** * Run Proguard to shrink the Java bytecode in release builds. */def enableProguardInReleaseBuilds = false/** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US.  Note that * this variant is about 6MiB larger per architecture than default. */def jscFlavor = 'org.webkit:android-jsc:+'/** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here.  If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */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        }    packagingOptions {            pickFirst 'lib/x86/libc++_shared.so'            pickFirst 'lib/x86_64/libc++_shared.so'            pickFirst 'lib/armeabi-v7a/libc++_shared.so'            pickFirst 'lib/arm64-v8a/libc++_shared.so'        }    defaultConfig {        applicationId "com.packageName"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode project.env.get("ANDROID_VERSION_CODE").toInteger()         versionName project.env.get("ANDROID_VERSION_NAME")        missingDimensionStrategy 'react-native-camera', 'general'        multiDexEnabled true    }    splits {        abi {            reset()            enable enableSeparateBuildPerCPUArchitecture            universalApk false  // If true, also generate a universal APK            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"        }    }    signingConfigs {        debug {        }        release {      }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        release {            // Caution! In production, you need to generate your own keystore file.            // see https://reactnative.dev/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 fileTree(dir: "libs", include: ["*.jar"])    //noinspection GradleDynamicVersion    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation 'androidx.multidex:multidex:2.0.1'    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"    // implementation 'com.android.support:support-annotations:28.0.0' implementation 'com.android.support:appcompat-v7:28.0.0'    implementation 'com.android.support:support-v4:28.0.0'    // implementation 'androidx.appcompat:appcompat:1.0.2'    // implementation 'androidx.annotation:annotation:1.0.2'      implementation 'me.leolin:ShortcutBadger:1.1.21@aar'      implementation 'com.google.firebase:firebase-analytics:17.5.0'      implementation 'com.google.firebase:firebase-crashlytics:17.2.2'      implementation "com.google.android.gms:play-services-base:16.1.0"      implementation 'com.google.firebase:firebase-core:16.0.9'      implementation 'com.google.firebase:firebase-messaging:20.3.0'      implementation "com.google.android.gms:play-services-gcm:12.+"    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {      exclude group:'com.facebook.fbjni'    }    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'        exclude group:'com.squareup.okhttp3', module:'okhttp'    }    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    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'apply plugin: 'com.google.firebase.crashlytics' // Google Play services Gradle plugincom.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

android NotificationListenerService is not working with incoming phone call

$
0
0

I am trying to listen to the incoming call notification. it was working fine in android. but some devices on Android 9 and 10 (real devices ) the incoming call is not handled by the notification listener service. in Emulator that is working fine.below is my code

public class RNAndroidNotificationListener extends NotificationListenerService {private static final String TAG = "RNAndroidNotificationListener";@SuppressLint("LongLogTag")@Overridepublic void onNotificationPosted(StatusBarNotification sbn) {    Notification notification = sbn.getNotification();    Log.e("Checking Notification","Checking Notification"+ String.valueOf(sbn));    if (notification == null || notification.extras == null) return;    String app = sbn.getPackageName();    boolean isDefault = isDefaultDialer(getApplicationContext(),app);    if (isDefault) {        if (app == null) app = "Unknown";        CharSequence titleChars = notification.extras.getCharSequence(Notification.EXTRA_TITLE);        CharSequence textChars = notification.extras.getCharSequence(Notification.EXTRA_TEXT);        if (titleChars == null || textChars == null) return;        String title = titleChars.toString();        String text = textChars.toString();        if (text == null || text == "" || title == null || title == "") return;        Log.d(TAG, "Notification received: " + app +" | " + title +" | " + text);        WritableMap params = Arguments.createMap();        params.putString("app", app);        params.putString("title", title);        params.putString("text", text);        RNAndroidNotificationListenerModule.sendEvent("notificationReceived", params);    }else{        Log.e("Else","Not an Incoming Call Notifcation");        return;    }}

Render an image exactly in on a physical scale (say 2 inches) irrespective of Display Size settings ,React Native?

$
0
0

I am trying to create an app in React Native (Version 0.62.2) that is able to display an image that should be exactly 2X2 inches in dimensions irrespective of device dimensions, orientation, or user's font/display phone settings.

Any help from the community is appreciated.

Unable to display a simple React Native (Android) View, of exact 2x2 inches(physical size) on all devices irrespective of phone's display settings

$
0
0

We have to display a view of exactly 2x2 physical inches across all devices.

According to our understanding,React native on Android uses density invariant pixels as default unit of size. From PixelRatio, we can get the phone's DPI (160 * PixelRatio).

Since, for any device basically, 1 Density invariant pixel = PixelRatio number of pixelsFrom this, to display a Block of 1 inch, basically we can just set the width /height to 160So, setting dimensions to 160*2 (for 2 inches)

<View style={{ width: 160*2, height: 160*2, backgroundColor: 'pink' }} />

should display 2 inch box on all device.And it does, under normal setting.

Issue: When we change phone's display settings, the Block is displayed few centimetres larger, on all devices.

The display settings changes the width, height for the app and PixelRatio of the device.Can't really understand why 160*2 is not working as it should not be PixelRatio dependent.

React native v62.2

Any help is appreciated. Thanks.

Unable to connect to paired bluetooth device

$
0
0

I am trying to connect Bluetooth devices which are paired and unpaired. Below I have attached the whole file. I am able to pair devices but could not connect the devices. How Do I do it?

I have used the below link to do the setup for the module.

https://www.npmjs.com/package/react-native-bluetooth-escpos-printer

Environment:

"react": "16.9.0",

"react-native": "^0.63.3",

"react-native-bluetooth-escpos-printer": "0.0.5"

import React, { useState, useEffect } from 'react';import {    SafeAreaView,    Text,    View,    Platform,    StyleSheet,    Alert,    DeviceEventEmitter,    ScrollView,    TouchableOpacity,    ActivityIndicator,    Dimensions,    StatusBar} from 'react-native';import { BluetoothManager, BluetoothEscposPrinter, BluetoothTscPrinter } from 'react-native-bluetooth-escpos-printer';const statusBarHeight = StatusBar.currentHeight;const height = (Dimensions.get('window').height - statusBarHeight) / 12;const customHeight = height * 0.9;const customMargin = height / 20;const width = (Dimensions.get('window').width - 10) / 2;const fontSize = Dimensions.get('window').height / 40;const BluetoothPrinter = () => {    const [pairedDs, setPairedDevices] = useState([]);    const [foundDs, setFoundDevices] = useState([]);    const [paired, setPaired] = useState([]);    const [found, setFound] = useState([]);    const [loading, setLoading] = useState(false);    const [boundAddress, setBoundAddress] = useState([]);    const [options, setOptions] = useState('');    const [waiting, setWaiting] = useState(true);    function enableBT() {        BluetoothManager.enableBluetooth().then((r) => {            var paired = [];            if (r && r.length > 0) {                for (var i = 0; i < r.length; i++) {                    try {                        paired.push(JSON.parse(r[i])); // NEED TO PARSE THE DEVICE INFORMATION                        if (ss.paired.length > 0) {                            setWaiting(false);                        }                    } catch (e) {                        //ignore                    }                }            }            console.log(JSON.stringify(paired));            Alert.alert("Enabled")            scanBTDevices();        }, (err) => {            alert(err)        });    }    function disableBT() {        BluetoothManager.disableBluetooth().then(() => {            // do something.        }, (err) => { alert(err) });    }    function scanBTDevices() {        BluetoothManager.scanDevices()            .then((s) => {                var ss = JSON.parse(s);                console.log(".................................")                console.log(ss.found);                if (ss.found.length > 0) {                    setWaiting(false);                }                setPairedDevices(ss.paired);                setFoundDevices(ss.found);                setLoading(false);                setPaired(ss.paired);                setFound(ss.found);                connectBTDevice({ "address": "64:6C:B2:DA:19:3D", "name": "Galaxy Grand Prime" });            }, (er) => {                setLoading(false),                alert('error'+ JSON.stringify(er));            });    }    function connectBTDevice(rowData) {        console.log("Connect device");        Alert.alert("Connecting......................");        BluetoothManager.connect(rowData.address) // the device address scanned.            .then((s) => {                console.log(s);                Alert.alert(s);                setLoading(false);                setBoundAddress(rowData.address);                // print();            }, (e) => {                console.log(e);                setLoading(false);                alert(e);            })    }    function _deviceAlreadPaired(rsp) {        console.log(rsp.devices);    }    function _deviceFoundEvent(rsp) {        console.log(rsp.devices);    }    useEffect(() => {        BluetoothManager.isBluetoothEnabled().then((enabled) => {            console.log(enabled);            if (!enabled) {                enableBT();            } else {                Alert.alert("Enabled")                scanBTDevices();            }        }, (err) => {            Alert.alert("err", err)        });        DeviceEventEmitter.addListener(            BluetoothManager.EVENT_DEVICE_ALREADY_PAIRED, (rsp) => {                _deviceAlreadPaired(rsp) // rsp.devices would returns the paired devices array in JSON string.            });        DeviceEventEmitter.addListener(            BluetoothManager.EVENT_DEVICE_FOUND, (rsp) => {                _deviceFoundEvent(rsp) // rsp.devices would returns the found device object in JSON string            });    }, []);    return (<SafeAreaView style={{ flex: 1 }}>            {                waiting ?<View style={[styles.container2, styles.horizontal]}><ActivityIndicator size="large" color="#0000ff" /></View>                    :<ScrollView>                        {                            foundDs.length && foundDs.length > 0 ? (                                foundDs.map((item, key) => {                                    return (<TouchableOpacity                                            key={key}                                            style={styles.surface}                                            onPress={() => connectBTDevice(item)}><Text style={styles.itemInfo}>{item.name}</Text></TouchableOpacity>                                    );                                })                            )                                : false                        }</ScrollView>            }</SafeAreaView>    );};export default BluetoothPrinter;const styles = StyleSheet.create({    container2: {        justifyContent: "center",    },    horizontal: {        flexDirection: "row",        justifyContent: "space-around",    },    itemInfo: {        fontSize,        fontWeight: 'bold',    },    surface: {        margin: customMargin,        justifyContent: 'center',        alignItems: 'center',        height: customHeight,        width: width,        elevation: 2,        borderRadius: 2,        backgroundColor: 'lightblue',    },});

react-native maps not loading for android (blank map)

$
0
0

I've been stuck on this for a long time now and am starting to think perhaps react native maps cannot work on android emulator, as all the answers I find that seem to work are for IOS anyways.

I am currently using android emulator to run my app. Here is the code for a simple map...

class MainMap extends Component {    constructor() {    super();  }    render(){        return (<View style={styles.container}><MapView    initialRegion={{      latitude: 37.78825,      longitude: -122.4324,      latitudeDelta: 0.0922,      longitudeDelta: 0.0421,    }}  /></View>        )    }}const styles = StyleSheet.create({  container: {    position: 'absolute',    top: 0,    left: 0,    right: 0,    bottom: 0,    justifyContent: 'flex-end',    alignItems: 'center',  },  map: {    position: 'absolute',    top: 0,    width:150,    height:150,    left: 0,    right: 0,    bottom: 0,  },});module.exports = MainMap;

The code seems like it should work, as I took it straight from an example. I even got my API key from google API and then added the following in my AndroidManifest.xml

<meta-data        android:name="com.google.android.geo.API_KEY"        android:value="api here"/>

Now, when I run react-native run-android the app seems to run fine, with no error messages. However, the app is blank. The View container loads fine, but its content MapView does not load at all. All I see is literally a blank screen.

Note that I also have Google Play services and Google API installed on my emulator too.

How can I debug this issue since I get no error messages at all? Can react-native maps even work on android emulator?

EDIT

I've been stuck on this for a long time now, and it's stalling me from being able to work on this project of mine. Because the nature of the question is difficult to debug, I am going to provide a github link to my repository in case anyone is willing to replicate the problem on their end and see what my issue is...

https://github.com/Bolboa/TTC-Mapping

All I need is for the map to load. The code looks like it should work, but the map does not load...

I am going to offer a bounty to anyone who can help me out.

Could not determine the dependencies of task ':app:lintVitalRelease'

$
0
0

I am new in react native and android development.Currently I want to build an APK but I faced this error.

**FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:lintVitalRelease'.

Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'. Could not resolve project :react-native-cookies. Required by: project :app Unable to find a matching configuration of project :react-native-cookies: None of the consumable configurations have attributes.**

In build.gradle file

    release {      signingConfig signingConfigs.release       matchingFallbacks = ['release', 'debug']     }  }dependencies {    implementation project(':react-native-cookies')    implementation project(':react-native-clear-app-cache')    implementation project(':react-native-vector-icons')    implementation project(':react-native-image-picker')    implementation project(':react-native-linear-gradient')    implementation project(':react-native-gesture-handler')    implementation project(':react-native-reanimated')    implementation fileTree(dir: "libs", include: ["*.jar"])    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation project(':react-native-orientation')}

In app/build.gradle file

buildscript {    ext {        buildToolsVersion = "28.0.3" //28.0.3        minSdkVersion = 16        compileSdkVersion = 28 //28        targetSdkVersion = 28        supportLibVersion = "28.0.0"    }    repositories {        google()        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:3.3.0'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}

I dont know how to solve as I tried many times to modified buildToolsVersion, buildTypes and so on. Any idea to solve this issue? Please help.


React Native Navigation Error: The action navigate with payload {"name": 192.168.100.189:19000", "params":{}} was not handled by any navigator

$
0
0

I am using react-navigation with my React Native application.

I keep on getting an error that is supposedly a development-only warning and on't be shown in production.

How do I fix the error below??

console.error: "The action 'NAVIGATE' with payload {"name":"192.168.100.189:19000","params":{}} was not handled by any navigator.

Do you have a screen named '192.168.100.189:19000'?

If you'r trying to navigate to a screen in a nested navigator, seehttps://reactnavigation.org/docs/nesting-navigators#navigating-to-a-screen-in-a-nestd-navigator.

This is a development-only warning and won't be shown in production."

Native-Base Component Picker issue

$
0
0

The app is crashing while i Load this component in the view. It used to working before.

import {Picker, View} from 'native-base';<View style={{flex:1}}><Picker mode="dropdown"><Picker.Item label="Select" value={0} /><Picker.Item label="Veg" value={0} /><Picker.Item label="Non-Veg" value={0} /></Picker></View>

Screenshot for the error

Android fragment view on react native page not showing up

$
0
0

I'm trying to render an Android Fragment on react native page using react native bridge. As soon as I try to replace the react native view with the android fragment, it shows a complete blank view.

I used Layout Inspector and found out that the fragment view (containing the text view mentioned in the screenshot) is in the stack but are not show. Attaching the screenshot for the same.Layout Inspector screenshot

Code for Android:

protected FrameLayout createViewInstance( ThemedReactContext reactContext) {      return new FrameLayout(reactContext);    @Override    public Map<String, Integer> getCommandsMap() {        return MapBuilder.of("create", 1        );    }    @Override    public void receiveCommand(FrameLayout root, int commandId, @Nullable ReadableArray args) {        super.receiveCommand(root, commandId, args);        int reactViewId = args.getInt(0);        createFragment(root, reactViewId);    }public void createFragment(FrameLayout root, int reactViewId) {        MyFragment fragment = MyFragment.newInstance(this.mCallerContext);        mActivity = (FragmentActivity)mCallerContext.getCurrentActivity();        mActivity.getSupportFragmentManager().beginTransaction()                .replace(reactViewId, fragment, String.valueOf(R.id.my_view_id))                .commitNow();        mActivity.getSupportFragmentManager().executePendingTransactions();    }

React native code:

const MyComponent = requireNativeComponent("MyComponent");componentDidMount() {        setTimeout(()=>{            this.create();        }, 2000);    }create = () => {        const androidViewid = findNodeHandle(this.nativeComponentRef);        UIManager.dispatchViewManagerCommand(            androidViewid,            UIManager.MyComponent.Commands.create,            [androidViewid],        );    };render() {        return (<View style={{ height: "100%", width: "100%", flex: 1 }} ><Text> IN REACT NATIVE</Text><MyComponent style={{ height: "90%", width: "90%", flex: 1 }} ref={(nativeRef)=>(this.nativeComponentRef = nativeRef)} /></View>        );    }

Can you please help why the android view is not showing up?

Detect android is connected to a car stereo's bluetooth

$
0
0

I want to develop an app on react native that starts only if the phone is connected with a car stereo's bluetooth. I know spotify changes its UI when that happens, so it must recognize the difference in someway.

Expo encountered a fatal error: Error while updating property 'text' in shadow node of type: RCTRawText

$
0
0

Problem summary:

Goal : To deploy a functional and stable Android app on Google Play.

Development environment :Expo 39.0.0

React Native 0.63

Physical device for testing : Honor 8x running on Android 10

Expected result : An Android app that doesn't crash

Actual result : Expo encountered a fatal error: Error while updating property 'text' in shadow node of type: RCTRawText

My Android app works perfectly without any warnings or error messages during development with Expo on a physical device Honor 8x/Android 10. When deployed in production, it crashes on all devices. adb logcat gives the above mentioned error message.

What have I tried :

  1. Checked all nodes that have a ternary operator or dynamic values dependent on state.
  2. Empyting cache, deleting data and relaunching the app.
  3. Asked for feedback from latest two other users. The app shows the same behaviour on their devices i.e. it crashes.
  4. Run expo start --no-dev --minify to verify if it throws any errors or warnings.
  5. Checked the apk on physical device with adb install <path to apk> . Tried this with multiple builds.

Minimum reproducible example : I can't isolate the source of the problem. Unfortunately I haven't installed Sentry. So I can't really share a specific code snippet that may be the root cause.

Defective app url on Google Play : https://play.google.com/store/apps/details?id=com.meetstargazers.application

Detailed Error Messages obtained by running adb logcat

AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {com.meetstargazers.application/host.exp.exponent.MainActivity}: java.lang.RuntimeException: Expo encountered a fatal error: Error while updating property 'text' in shadow node of type: RCTRawTextAndroidRuntime: Caused by: java.lang.RuntimeException: Expo encountered a fatal error: Error while updating property 'text' in shadow node of type: RCTRawText
Viewing all 29639 articles
Browse latest View live


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