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

React-Native Webview html file doesn't show when offline

$
0
0

I'm creating an app using React-Native. I'm using Webview in order to display a local html file in the app. This works perfectly when the phone has internet connection, but otherwise nothing is shown. Is it possible to have Webview display a local HTML file without internet connection?

Webview code:

      WebView        source={{ uri: 'file:///android_asset/test.html' }}      />

"Network request failed" with react-native (even with `android:usesCleartextTraffic="true"`)

$
0
0

I did npx react-native init AwesomeProject to create a new project (I'm following the official get-started tutorial. When I simply run npx react-native start and then npx react-native run-android without tweaking anything everything works fine. But I need to make an API call, so I tried copying and pasting the example from the official network tutorial (only without the try/catch, so I can see the errors) into App.js (right after the imports):

async function getMoviesFromApiAsync() {    let response = await fetch('https://reactnative.dev/movies.json'    );    let json = await response.json();    console.log(json.movies);    return json.movies;}

Then right below it I added a call to that function:

getMoviesFromApiAsync();

That gives me a Network request failed error. This is the full error message I see on Terminal:

Fri May 08 2020 10:23:00.325]  WARN     Possible Unhandled Promise Rejection (id: 0):TypeError: Network request failedonerror@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28005:31dispatchEvent@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:34133:31setReadyState@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:33217:33__didCompleteResponse@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:33044:29emit@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:3420:42__callFunction@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2748:49http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2470:31__guard@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2702:15callFunctionReturnFlushedQueue@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2469:21callFunctionReturnFlushedQueue@[native code]

I googled around and ended up trying the following:

1) I added android:usesCleartextTraffic="true" to AndroidManifest.xml

2) I added a bunch of permissions to AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

3) I added android:networkSecurityConfig="@xml/network_security_config" to AndroidManifest.xml

4) I tried setting a proxy (10.0.2.2) and port (8081), as suggested in here

5) I tried deleting the app from the emulator and reinstalling it, as well as clearing the cache (npx react-native start --reset-cache)

Nothing seems to work. I still get the same "Network request failed" message.

I'm using React Native 0.62.2 on a Pixel 2 API 28 emulator running Android 9.0, on macOS Catalina.

ReactNative: Could not resolve all artifacts for configuration ':classpath'. Could not find com.android.tools.build:gradle:3.6.3

$
0
0

Trying to build the android app made by ReactNative, I faced following error:

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

This app is work well in other environment. But when I trying to build it in new environment, the above error come up. (The new environment means the new PC and new version of Android Studio. etc.) The following is the new environment.

  1. jdk (the only thing that is same with previous environment)
java 12.0.2 2019-07-16Java(TM) SE Runtime Environment (build 12.0.2+10)Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
  1. build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 16        compileSdkVersion = 28        targetSdkVersion = 28    }    repositories {        mavenCentral()        google()        jcenter()    }    dependencies {        classpath('com.android.tools.build:gradle:3.6.0')        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        mavenLocal()        maven {            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm            url("$rootDir/../node_modules/react-native/android")        }        maven {            // Android JSC is installed from npm            url("$rootDir/../node_modules/jsc-android/dist")        }        google()        jcenter()        maven { url 'https://jitpack.io' }    }}
  1. gradle.properties
distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
  1. Compile Sdk Version for moduleiamport-react-native
28 (API 28: Android 9.0(Pie))
  1. Build Tools Version for moduleiamport-react-native
28.0.3

Although searching and applying many ways, I couldn't resolve this error. The big problem is that I do not know what is the problem exactly.

So, how can I fix it and build successfully?

How to sign Expo app APK to update existing App on Google Play Store?

$
0
0

I have an EXPO app and I already created and published it on Google Play Store. The Google App Signing is activated for this project. Now I want to update this APK in this project. I used the command 'expo build:android' to build the updated APK. But when I send it to my project on Play store, it says that the certificate is wrong ('Upload failed You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate').

Expo-Vector-Icons show up on my Snack but are showing as question mark or Chinese character in the Android built app

$
0
0

I am importing the files correctly as mentioned in documentation. I checked the package.json if it includes any old dependency that can lead to this error but I am not finding it. I will include here my package.json dependencies. The app also starts at app.js not main or anything else. I tried removing the @expo/vector-icons, but it gives an error when building for android (expo build:android) 'Missing @expo/vector-icons. The problem is still persisting and I am not getting the icons but just X symbols.

"@expo/vector-icons": "^10.0.3","expo": "^33.0.0","expo-asset": "^5.0.1","expo-constants": "^5.0.1","expo-font": "^5.0.1","haversine": "1.1.1","lodash": "4.17.11","pretty-ms": "4.0.0","prop-types": "15.7.2","react": "16.8.3","react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz","react-native-compress": "2.0.1","react-native-elements": "0.19.1","react-native-keyboard-aware-scroll-view": "0.8.0","react-native-vector-icons": "5.0.0","react-navigation": "^3.0.0","react-navigation-material-bottom-tabs": "0.1.2"

Detox - Android / iOS - Cannot run the same test on android

$
0
0

I had been trying to find information about this error that I will post below, I did all the configurations and made research, I am using the latest version of everything.But since I am new to Detox, I was assuming that the test written for iOS works for Android, if so please ignore and please provide details on how to adapt.Basically the error I am getting is this:

detox[40905] INFO:  [test.js] configuration="android.emu.debug" reportSpecs=true readOnlyEmu=false useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1588961953280 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "e2e"detox[40909] INFO:  [DetoxServer.js] server listening on localhost:49577...detox[40909] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] DetoxRuntimeError: Failed to run application on the deviceHINT: Most likely, your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.    at EmulatorDriver._getInstrumentationCrashError (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:165:12)    at EmulatorDriver.instrumentationCloseListener (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:128:67)    at EmulatorDriver._terminateInstrumentation (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:156:12)    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at ChildProcess.<anonymous> (/Users/brunosoko/Documents/appExam/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:274:7) {  name: 'DetoxRuntimeError'}detox[40909] INFO:  Example: should show login screen after tap on Sign in button

I do not know if it's a bug or something that I am doing wrong.Here's my package.json

"detox": {"specs": "","configurations": {"ios.sim.debug": {"binaryPath": "/Users/brunosoko/Library/Developer/Xcode/DerivedData/AppExam-cwpqhbjlywwwihfaazprzmynvoym/Build/Products/Debug-iphonesimulator/appExam.app","type": "ios.simulator","name": "iPhone 11"      },"android.emu.debug": {"binaryPath": "/Users/brunosoko/Documents/AppExam/android/app/build/outputs/apk/debug/app-debug.apk","type": "android.emulator","name": "Pixel_3_API_R_2"      }    },"test-runner": "jest"  },

Please HELP!

Detox does not run tests on Android but works fine on iOS

$
0
0

The application's tests run fine on iOS but it just is stuck on the splash screen.

I have run the build command for android which created the build perfectly fine. When upon running test command to run the E2E test the app gets installed but it does not execute any test.

The application gets installed for the tests but no tests are run. It seems as detox server is not able to find and UI elements with test ID.

below is some part from the package.json file.

"devDependencies": {"babel-core": "^7.0.0-beta.47","babel-jest": "^23.2.0","detox": "10.0.3","eslint-config-rallycoding": "^3.2.0","jest": "^23.4.2","react-test-renderer": "16.4.1"  },"jest": {"preset": "react-native"  },"devDependencies": {"babel-core": "^7.0.0-beta.47","babel-jest": "^23.2.0","detox": "10.0.3","eslint-config-rallycoding": "^3.2.0","jest": "^23.4.2","react-test-renderer": "16.4.1"      },"detox": {"test-runner": "jest","specs": "e2e","configurations": {"ios.sim.debug": {"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/hektor.app","build": "cd ios && xcrun xcodebuild -workspace hektor.xcworkspace -scheme hektor -configuration Debug -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1'  -derivedDataPath build && cd ..","type": "ios.simulator","name": "iPhone X"          },"android.emu.debug": {"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk","build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..","type": "android.attached","name": "2e1c66bf","adb": "2e1c66bf"          }        }      }}

Am sharing the link of the repo on which I uploaded the end to end tests code.

https://github.com/waneed-plero/e2e-tests.git

Dependencies:

React Native: 0.56.0

Node: 11.9.0

Device: android

Can we run android emulator without VTx enabled processor?

$
0
0

I have hp laptop with intel pentium 987 1.5Ghz running on windows 10pro. I want to run android emulator fro react-native-cli. When i created virtual device in android studio {API 26} it says your processor does not support VTx virtualization.

Does that means i can not run react-native-cli apps ?

And the only option is that to use expo ?

Is there any alternative ?


Execution failed for task ':react-native-keychain:compileReleaseJavaWithJavac'. when trying to ./gradlew bundleRelease

$
0
0

I am trying to get the .aab and the .apk files to publish the android side of a react-native app to the Google Play Store. After about 2 minutes of working Task :react-native-keychain:compileReleaseJavaWithJavac FAILED is printed.

It gives a little more information but I have been unable to find anything that fixes this error.

Execution failed for task ':react-native-keychain:compileReleaseJavaWithJavac'.> Compilation failed; see the compiler error output for details.

Logs:

/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:5: error: package android.support.annotation does not existimport android.support.annotation.NonNull;                                 ^/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:3: error: package android.support.annotation does not existimport android.support.annotation.NonNull;                                 ^/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:4: error: package android.support.annotation does not existimport android.support.annotation.NonNull;                                 ^/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:8: error: package android.support.annotation does not existimport android.support.annotation.NonNull;                                 ^/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:4: error: package android.support.annotation does not existimport android.support.annotation.NonNull;                                 ^/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:33: error: cannot find symbol    public ResultSet getEncryptedEntry(@NonNull String service) {                                        ^  symbol:   class NonNull  location: class PrefsStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:47: error: cannot find symbol    public void removeEntry(@NonNull String service) {                             ^  symbol:   class NonNull  location: class PrefsStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:58: error: cannot find symbol    public void storeEncryptedEntry(@NonNull String service, @NonNull EncryptionResult encryptionResult) {                                     ^  symbol:   class NonNull  location: class PrefsStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/PrefsStorage.java:58: error: cannot find symbol    public void storeEncryptedEntry(@NonNull String service, @NonNull EncryptionResult encryptionResult) {                                                              ^  symbol:   class NonNull  location: class PrefsStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;                              ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;                                                       ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:42: error: cannot find symbol    EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException;                                                                                 ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;                              ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;                                                       ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:44: error: cannot find symbol    DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException;                                                                                 ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorage.java:46: error: cannot find symbol    void removeKey(@NonNull String service) throws KeyStoreAccessException;                    ^  symbol:   class NonNull  location: interface CipherStorage/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:186: error: cannot find symbol    public void hasInternetCredentialsForServer(@NonNull String server, Promise promise) {                                                 ^  symbol:   class NonNull  location: class KeychainModule/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:200: error: cannot find symbol    public void setInternetCredentialsForServer(@NonNull String server, String username, String password, String minimumSecurityLevel, ReadableMap unusedOptions, Promise promise) {                                                 ^  symbol:   class NonNull  location: class KeychainModule/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:205: error: cannot find symbol    public void getInternetCredentialsForServer(@NonNull String server, ReadableMap unusedOptions, Promise promise) {                                                 ^  symbol:   class NonNull  location: class KeychainModule/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:210: error: cannot find symbol    public void resetInternetCredentialsForServer(@NonNull String server, ReadableMap unusedOptions, Promise promise) {                                                   ^  symbol:   class NonNull  location: class KeychainModule/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/KeychainModule.java:299: error: cannot find symbol    @NonNull     ^  symbol:   class NonNull  location: class KeychainModule/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                     ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                                              ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:91: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                                                                        ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:148: error: cannot find symbol    private void generateKeyAndStoreUnderAlias(@NonNull String service, SecurityLevel requiredLevel) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, CryptoFailedException {                                                ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                     ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                                              ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:164: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                                                                        ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:189: error: cannot find symbol    public void removeKey(@NonNull String service) throws KeyStoreAccessException {                           ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:265: error: cannot find symbol    private String getDefaultServiceIfEmpty(@NonNull String service) {                                             ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageKeystoreAESCBC.java:264: error: cannot find symbol    @NonNull     ^  symbol:   class NonNull  location: class CipherStorageKeystoreAESCBC/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                     ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                                              ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:49: error: cannot find symbol    public EncryptionResult encrypt(@NonNull String service, @NonNull String username, @NonNull String password, SecurityLevel level) throws CryptoFailedException {                                                                                        ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                     ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                                              ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:72: error: cannot find symbol    public DecryptionResult decrypt(@NonNull String service, @NonNull byte[] username, @NonNull byte[] password) throws CryptoFailedException {                                                                                        ^  symbol:   class NonNull  location: class CipherStorageFacebookConceal/Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageFacebookConceal.java:93: error: cannot find symbol    public void removeKey(@NonNull String service) {                           ^  symbol:   class NonNull  location: class CipherStorageFacebookConcealNote: /Users/thomasstansel/Documents/GitHub/monitoring-mobile-app/node_modules/react-native-keychain/android/src/main/java/com/oblador/keychain/DeviceAvailability.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.

I have also run the app in android studio and get the same error. I am especially confused because the app works when I run the npx react-native run-android command.

If any more information is needed please let me know and thank you in advance for any help!

React Native Expo : Listen to Video Sound When app is annactive but it’s still working on background

$
0
0

Could i Listen to Video Sound When app is innactive but it’s still working on background ? this feature exist for audio using staysActiveInBackground property but not for Video.

SDK Version:

expo 37.0.3

Platforms

android/ios

Thank’s

React native TouchableOpacity onPress not working on Android

$
0
0

TouchabelOpacity works fine on iOS but the onPress method does not work on Android for me.

My react-native version: 0.57.4

My code:

const initDrawer = navigation => (<TouchableOpacity    style={{ left: 16 }}    onPress={() => onPressDrawerButton(navigation)}><Ionicons name="ios-menu" color="white" size={30} /></TouchableOpacity>);

A valid Facebook app id must be set in the AndroidManifest.xml

$
0
0

I am trying to setup fbsdk on Android using react native and the fbsdk wrapper https://github.com/facebook/react-native-fbsdk. I have it working on iOS but I am stuck on Android. I followed all the steps according the github readme.

MainApplication.java

@Override  public void onCreate() {    super.onCreate();    FacebookSdk.sdkInitialize(getApplicationContext());    SoLoader.init(this, /* native exopackage */ false);  }

strings.xml

<resources><string name="app_name">FacebookLogin</string><string name="facebook_app_id">1343643482425305</string><string name="fb_login_protocol_scheme">fb1343643482425305</string></resources>

AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.ApplicationId"        android:value="@string/facebook_app_id"/>

But I am getting this error from LogCat

11-22 06:57:13.236 7570-7570/? I/zygote: Not late-enabling -Xcheck:jni (already on)11-22 06:57:13.244 7570-7570/? W/zygote: Unexpected CPU variant for X86 using defaults: x8611-22 06:57:13.361 7570-7570/com.facebooklogin I/FacebookInitProvider: Failed to auto initialize the Facebook SDK                                                                       A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.                                                                           at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:276)                                                                           at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:232)                                                                           at com.facebook.internal.FacebookInitProvider.onCreate(FacebookInitProvider.java:20)                                                                           at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)                                                                           at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)                                                                           at android.app.ActivityThread.installProvider(ActivityThread.java:6285)                                                                           at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)                                                                           at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)                                                                           at android.app.ActivityThread.-wrap1(Unknown Source:0)                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)                                                                           at android.os.Handler.dispatchMessage(Handler.java:105)                                                                           at android.os.Looper.loop(Looper.java:164)                                                                           at android.app.ActivityThread.main(ActivityThread.java:6541)                                                                           at java.lang.reflect.Method.invoke(Native Method)                                                                           at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)11-22 06:57:13.364 7570-7570/com.facebooklogin D/AndroidRuntime: Shutting down VM11-22 06:57:13.365 7570-7570/com.facebooklogin E/AndroidRuntime: FATAL EXCEPTION: main                                                                 Process: com.facebooklogin, PID: 7570                                                                 java.lang.RuntimeException: Unable to create application com.facebooklogin.MainApplication: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.                                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5794)                                                                     at android.app.ActivityThread.-wrap1(Unknown Source:0)                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)                                                                     at android.os.Handler.dispatchMessage(Handler.java:105)                                                                     at android.os.Looper.loop(Looper.java:164)                                                                     at android.app.ActivityThread.main(ActivityThread.java:6541)                                                                     at java.lang.reflect.Method.invoke(Native Method)                                                                     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)                                                                  Caused by: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.                                                                     at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:276)                                                                     at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:232)                                                                     at com.facebooklogin.MainApplication.onCreate(MainApplication.java:53)                                                                     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)                                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)                                                                     at android.app.ActivityThread.-wrap1(Unknown Source:0)                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)                                                                      at android.os.Handler.dispatchMessage(Handler.java:105)                                                                      at android.os.Looper.loop(Looper.java:164)                                                                      at android.app.ActivityThread.main(ActivityThread.java:6541)                                                                      at java.lang.reflect.Method.invoke(Native Method)                                                                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

React Native - Gradle deprecated features

$
0
0

When I start a project in React Native I get:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

(I started to get this suddenly and, with this, all old and new RN projects stopped opening. I tried to reinstall RN environment, but still got this. Now I think the problem is with gradle, because that is the only error message I get.)

So I looked for ran gradle help --scan to look for the deprecated stuff and got:

This will fail with an error in Gradle 7.0.1 usageUnknown:DeprecateUndefinedBuildWorkExecutor.java:37at org.gradle.execution.DeprecateUndefinedBuildWorkExecutor.execute(DeprecateUndefinedBuildWorkExecutor.java:37)•••

Now I don’t know how to solve this, “undeprecate” it.I'm on a windows 10.Please help. I’ve been trying to solve this for almost a whole month and I just can’t use React Native

expo react native android clicking screen under stack navigation error

$
0
0

I made an Android App with react-native and expo, and I noticed very weird bug in my app. It is the bug that it is possible to click screen in the stack navigator which is under the current screen.

For example, let's say this is Home screen in stack navigator.

If I push the third tab, which is written "컵", it pushes stack screen in the stack navigator.

After that, If I press certain area of the screen(I marked on the image), it goes to this screen, which is the screen that goes when I press the fourth tab in the home screen which is written "asdf".

My guess is that it happens because pressing screen under the current screen(sharing same stack navigation) is possible. Can anybody help please? ㅠㅠ

Generate Android pre-build that can accept environment variables

$
0
0

Note: The android app uses react native.

  • I have a complex CI process of multiple repositories to create a unique server environment with terraform every time I run the CI.
  • After setting up the servers, I get a public ip.
  • This public ip I then feed to android build.
  • I build the android app and the CI is complete.

Problem I have is:

  • The android build takes quite some time.

Solution I'm looking for:

  • Some way to pre-build the android app earlier in the CI process.
  • When the backend servers are setup, I want to run a quicker script thattake the pre-build app and inject the public ip and complete the apk.

Is this possible? (I'm also looking for iOS solution but focus on android for now.)


Android device doesn't vibrate when calling Vibration.vibrate() in HeadlessJS function

$
0
0

I am successfully using Vibration.vibrate([1000, 2000], true); inside a component in a React Native Android app - the device vibrates when this is called.

However I am also using HeadlessJS to launch a notification when the app is in the background or killed:

App.js:

import backgroundNotificationHandler from './src/services/backgroundNotificationListener';...AppRegistry.registerComponent(appName, () => App);firebase.messaging().setBackgroundMessageHandler(backgroundNotificationHandler);

backgroundNotificationListener.js:

import { NativeModules, Vibration } from 'react-native';import { parseTimeStringForNotification } from './parseTime'import InCallManager from 'react-native-incall-manager';const backgroundNotificationHandler = async message => {  console.log(Vibration); // logs the Vibration object  InCallManager.startRingtone('_BUNDLE_'); // this works  Vibration.vibrate([1000, 2000], true); // this doesn't work...

Is there any reason this shouldn't work? Is there some kind of OS restriction on this / should I try a third party package here to make the device vibrate?

Thanks!

React Native InApp Browser - Selecting a file (File Explorer) for uploading make InApp browser to close only with Google Chrome

$
0
0

I am currently working on a project on Android using the Expo client for react native. When I use expo-web-browser or react-native-inappbrowser-reborn and call for example WebBrowser.openBrowserAsync("https://fr.imgbb.com/"), it will open the website correctly. When I try to upload a file, it opens the file explorer correctly but when I select an image or other files, it closes the InApp Browser and redirect me to the App.

This problem occurs only if the InApp Browser is powered by Google. When I use for example the browser Samsung Internet, the problem doesn't occur.

Am I missing something ?

PS: My app is already detached from expo

Is there anyway to send sms in background for both Android & IOS?

$
0
0

I wanna make an app that its main functionality depends on sending SMS. before i was developing android(native) but now im using React-Native to make it for both IOS and Android.

in android it's possible to send sms in background if you get user permission. but after searching through net i couldn't find a way to do it in react-native. i read that Apple doesn't let apps to do so.i'm wondering if there is anyway to send SMS in background for both Android and IOS.

the libraries i've already seen, open phone sms interface(filled with number and smsBody) and then user must push send button(i wanna remove this step. i mean app sends sms automatically).

after all, is there anyway( library, ...) that can sends sms in background without opening sms interface for both android and ios?

Hide FingerPrint Native UI

$
0
0

How do I hide the fingerprint native UI so that I can show my custom using functional components.

Am having below component that has the <FingerPrintPop /> component which renders instead of rendering the native ui, but still the native ui still shows, how do i hide it. thanks

const FingerPrintAuth = (props) => {    const [state, setState] = useState({      errorMessageLegacy: undefined,      biometricLegacy: undefined,    })    useEffect(() => {        return () => {            FingerprintScanner.release()        }    })    const requiresLegacyAuth = _ => {        return Platform.Version < 23    }    const authCurrent = _ => {        FingerprintScanner.authenticate({title: 'Login with BioMetrics'})        .then((res)=>{            console.log(res)        })        .catch(error => console.log(error))    }    const authLegacy = _ => {        FingerprintScanner.authenticate({onAttempt: handleAttemptedAuthLegacy})        .then(res => {            console.log(res)        })        .catch(error => {            setState(prev=>({                ...prev,                errorMessageLegacy: error.message,                biometricLegacy: error.biometric            }))        })    }    const handleAttemptedAuthLegacy = error => {        setState(prev=>({            ...prev,            errorMessageLegacy: error.message,        }))    }    if (requiresLegacyAuth()) {        authLegacy()        return <FingerPrintPop />    } else {        console.log("rererrerere")        authCurrent()        return <FingerPrintPop />    }}

Expo push notification sound and popup doesn't work

$
0
0

I am developing an app with expo and push notification works fine but without sound and it doesn't popup..

Note: it only vibrates but without notification sound.

My client side

 if (Platform.OS === 'android') {      Notifications.createChannelAndroidAsync('notification-sound-channel', {        name: 'Notification Sound Channel',        sound: true,        priority: 'max',        vibrate: [0, 250, 250, 250],      });    }

My server side is php laravel: https://github.com/Alymosul/exponent-server-sdk-php

$notification = ['title' => $this->'test title','body'  => $this->'test body','channelId' => 'notification-sound-channel',];

I also tested it with expo Push notifications tool: https://expo.io/notifications and it works the same (vibration without sound or popup)

environment

expo: "^37.0.8",

SDK version: 27,

Testing device android version: 9

Viewing all 28468 articles
Browse latest View live


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