enter image description here I'm try to update 1 item to my server. It work in Post man
enter image description here But in react-native app, it do not work!
enter image description here I'm try to update 1 item to my server. It work in Post man
enter image description here But in react-native app, it do not work!
I generated signed apk with android studio for my react native application.
I installed the apk in my android mobile for testing.
My application use axios to login and the route of the API is :
http://preprod.api.partage-mandats.proprietes-privees.com/authentication_token
When I run the application with Android Studio I can login simply to my app but when I use the
Installed release apk I can't login and I can't get any response when I click the login button.
It seems like there's not runned server.
In my app/build.gradle I added :
release {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
And I added MYAPP_UPLOAD_STORE_FILE in the app folder.
I used "Generated signed bundle / apk" from Android studio build menu.
I am having working React Native application having version 0.38.0, when i have tried to upgrade it to 0.45.1 it is showing following error
java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
at com.facebook.react.cxxbridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:198)
at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:216)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:994)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:746)
at java.lang.Thread.run(Thread.java:761)
I have tried following solutions but it didn't work for me
SO: unable to load script from assets index.android.bundle on windows
SO: react native android failed to load JS bundle
I would like to test my app on at least 2 Android emulators simultaneously. I can start 2 emulators but can't seem to find how to react-native run-android
my app on 2 emulators with ADB. If possible I would also like to be able to run a react-native log-android
on each one while testing my app.
Is there a way to do so ?
Well this question might not be directly related to any code issues but would like to know what is the general way in which we can have different environment configs for different build types.
In my case, I am looking for three different build types: DEBUG, STAGING, RELEASE where each build type should use different API_BASE_URL and some other keys. I have seen few react-native modules out there such as react-native-config
but they seem to be unmaintained as there is a long list of issues unresolved.
App center is also another choice but comes with limitations in the free tier and the paid plan is out of my reach.
So, I would like to know what approaches do app developers usually take to achieve what I am looking for, keeping in mind the 12 factors and also how do I set the build types?
I followed all the steps in React Native's get started page, including running npx react-native init AwesomeProject
to create a starter project. (I'm following the steps for "React Native CLI Quickstart" / "macOS" / "Android"). Then I open up Android Studio, start the emulator, cd into the project's folder, and run npx react-native run-android
. Everything works fine. I get to tweak the starter project here and there, reload, and everything works.
But I need to use React Navigation. I follow the steps here and apparently React Navigation is installed without any issues. Then when I run npx react-native run-android
again the thing builds successfully and that Metro thing - that separate Terminal tab/window - says "done". But the emulator doesn't show my app. For a second it shows a blank page and then that disappears and I get the emulator's home screen. That's even if I don't tweak the starter code at all - I'm not even trying to import React Navigation, all I need to do to cause this error is to have it installed.
Here's what my Terminal tabs look like after npx react-native run-android
:
I've tried closing Terminal and Android Studio after installing React Navigation. Same thing.
I'm using macOS 10.15.3 and Android Studio 3.5.3.
What am I doing wrong?
I creating an android native module from an existing Java library. This library, make a GLSurfaceView
setEGLContextClientVersion(2);
setRenderer(new GLSurfaceView.Renderer() {
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
//Do things
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//Do things
}
@Override
public void onDrawFrame(GL10 gl) {
{
//Do things
}
}
});
into an android layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.___.FpvActivity">
<com.____.GLSurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.____.GLSurfaceView>
</RelativeLayout>
and set it by
setContentView(R.layout.activity_fpv);
What I want to do, is a react native module ( only android ) to include this view into a React Native Component. This View must be in the background of other RN elements.
What I'd tried to do is to inflate this layout by a ViewManager by
View.inflate(getApplicationContext(), R.layout.activity_fpv, null);
but without solution.
I can only see the original layout without my element ( put over in .js file)
Some ideas? This is my first experience with an RN Native module with layout interaction and I don't have much experience in Android/Java language
In React Native, there is WebView
what can be used as fullscreen web browser for example for SSO auth.
But there is also another way, developers achieving same without usage of WebView. They seems to use default browser defined in OS to display SSO auth or some different web app.
The page is not fullscreen, there is readonly URL bar and three dots with settings + message Powered by <browser>
What is the name or how to make this? It seems to me as much better solution, because WebView not supporting everything and just using Chrome or other browser is much better.
I'm installing react-native-firebase, async-storage and react-native-maps on a project.
All the modules from NPM contain the character @ at the beginning of their name and I think this produces the below error.
Can anyone please tell me how to efficiently remove the duplicate modules? Android studio keeps on adding them.
ERROR: The modules ['android-@react-native-firebase_app', 'react-native-firebase_app'] point to the same directory in the file system.
Each module must have a unique path.
ERROR: The modules ['android-@react-native-firebase_messaging', 'react-native-firebase_messaging'] point to the same directory in the file system.
Each module must have a unique path.
ERROR: The modules ['android-@react-native-community_async-storage', 'react-native-community_async-storage'] point to the same directory in the file system.
Each module must have a unique path.
ERROR: The modules ['android-@react-native-firebase_analytics', 'react-native-firebase_analytics'] point to the same directory in the file system.
Each module must have a unique path.
I am implementing on simple app in React Native
in which, I need to load image from server.
For that I am using axios
for make http
call and get result from local server.
Now, I am getting result perfectly. Problem is that Image URL is of localhost
So that, that URL is not load in my mobile device because images are not exist in mobile device
.
Is there any configuration that can enable to load localhost image into mobile device ?
Hi i got this error when i try to run react app on my real android device via : react-native run-android
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to install all
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The react-native app I'm working on uses Bluetooth. In the IOS version, the only permission(s) that require user confirmation is attemptToTriggerLEPairing. However, in the Android version of the app, there is a method that contains the following:
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION)
.then(granted => {
if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {
this.startScan();
return;
}
return PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION, {
'title': I18n.t('permission_location_title'),
'message': I18n.t('permission_location_desc')
}
)
.then(granted => {
if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {
this.startScan();
}
})
})
.catch(error => {
// TODO: error;
});
Why does the Android version require coarse location, but the IOS version does not?
react-native: 0.57.0 yarn : 1.9.4 nodejs: 9.10.1
react-native run-android give me this error:
[android, dev] ..\..\../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 - - [14/Sep/2018:07:12:00 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-""okhttp/3.10.0"
error: bundling failed: ReferenceError: SHA-1 for file c:\wamp64\www\React\hello1\index.js is not computed
at DependencyGraph.getSha1 (c:\wamp64\www\React\hello1\node_modules\metro\src\node-haste\DependencyGraph.js:238:119)
at c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:168:56
at Generator.next (<anonymous>)
at step (c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:11:657)
at c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:11:817
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
I have started a project using ignite CLI.
After waiting for a long time for it to create the project it gave me the following instructions to start the project:
npx react-native run-ios
npx react-native run-android
I then ran the command npx react-native run-android
It then gave me the following errors:
BUILD FAILED in 1m 21s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring project ':app'.
The SDK directory '/Users/bliss/Library/Android/sdk-' does not exist.
What is it looking for the sdk in 'sdk-' please take notice of the "-" at the end.
I then opened Android Studio to find out where my SDK manager is located and found that it is in
/Users/bliss/Library/Android/sdk
and not
/Users/bliss/Library/Android/sdk-
What should I do about this??? Why does a ignite project look for the sdk in sdk- and not just plain sdk? Is it a good idea to rename the folder? I am wary about renaming the folder to sdk- because I'm afraid that it might break other projects, etc....
What is the best solution?
This is the link to the ignite cli https://github.com/infinitered/ignite
I am wanting to develop an app where a user can select different gamepacks to install on their android or ios device. A gamepack will consist of:
Right now I'm not really concerned if these are transferred individually or in a zip file (though a zip file would certainly be preferred). Of course the device will need to be connected to the Internet to get the current list of gamepacks and to download the ones that the user chooses. Once the gamepacks are downloaded to the phone the user will not need an Internet connection to play the game as they will have all the files.
How do I go about implementing this in my project?
How do I download the files? Would I use the react-native-fetch-blob library and save it in a specific location? This library refers to saving it as "cache" rather than permanently, so I am not sure if this is the correct solution. The specific section I am looking at on the library page is "Use Specific File Path". But because it is cache, should I be looking for something else that is more of a longer term storage? It does say on the page that files will not be deleted so I am a bit confused as to what the difference between permanent storage and cache is in this case.
Once the files are downloaded would I then be able to open images and display them, open sound files and play them, and open the json files and process them?
I have tried many ways to fix this error but all attempts have failed.
- FOR ANDROID NOT IOS.
_RNGestureHandlerModule.default.Direction
I was trying for android. I found bug react-native-gesture-handler buy I don't know how to fix it.
I am following this instruction step by step https://reactnavigation.org/docs/en/getting-started.html
I tried linking the react-native-gesture-handler manual. and also tried unlinked. I made react-native.config.js with code
exports = {
dependencies: {
'react-native-gesture-handler': {
platforms: {
android: null,
ios: null,
},
},
},
};
I am using System:
OS: Linux 5.3 Arch Linux undefined
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 16.06 GB / 31.21 GB
Shell: 5.0.11 - /bin/bash
Binaries:
Node: 12.13.0 - /usr/bin/node
Yarn: 1.19.1 - /usr/bin/yarn
npm: 6.12.1 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.4 => 0.61.4
npmGlobalPackages:
react-native-cli: 2.0.1
"react-navigation": "^2.18.2",
"react-navigation-stack": "^1.10.3"
- FOR ANDROID NOT IOS.
_RNGestureHandlerModule.default.Direction I wrote about the bug react-native-gesture-handler Github
I am using axios
to post some data to server in react native but i am having an issue my code is running well in IOS but i am having few issue with the android case. Here is my code , have a look on it.
login = () => {
const { username, password } = this.state;
let reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (username == "") {
//alert("Please enter Email address");
this.setState({ email: "Please enter Email address" });
} else if (reg.test(username) === false) {
//alert("Email is Not Correct");
this.setState({ email: "Email is Not Correct" });
return false;
} else if (password == "") {
this.setState({ email: "Please enter password" });
} else {
this.openProgressbar();
axios
.post(
CONSTANT.BaseUrl + "user/do-login",
{
email: username,
password: password
}
)
.then(async (response) => {
if (response.data.type == "success") {
await AsyncStorage.setItem(
"full_name",
response.data.profile.pmeta.full_name
);
await AsyncStorage.setItem(
"user_type",
response.data.profile.pmeta.user_type
);
await AsyncStorage.setItem(
"profile_img",
response.data.profile.pmeta.profile_img
);
await AsyncStorage.setItem(
"profileBanner",
response.data.profile.pmeta.banner_img
);
await AsyncStorage.setItem(
"profileType",
response.data.type
);
await AsyncStorage.setItem(
"projectUid",
response.data.profile.umeta.id
);
await AsyncStorage.setItem(
"projectProfileId",
JSON.stringify(response.data.profile.umeta.profile_id)
);
this.setState({ isProgress: false })
RNRestart.Restart();
} else if (response.data.type == "error") {
this.setState({ isProgress: false });
alert("Please Check Your Email / Password or Check Network ");
}
})
.catch(error => {
console.log(error);
});
}
Keyboard.dismiss();
};
In the IOS case it is moving in .then
after response but in ANDROID it is going in .catch
i want create android deploy from my React Native app with gradle, but i get
Could not find method classpath() for arguments [com.braintreepayments.api:braintree:2.17.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
error. My app/build.gradle available in https://github.com/elekakos2703/test/blob/master/build.gradle, because code tag is not working fine.
Thank you for helping.
in mobile app support Arabic and English , user name can be Arabic or English , if app in mode English and user name is Arabic , the notification is like "محمد send order" and this text in Text tag on IOS is OK with writingDirection props , but in android was shown like " send order محمد".
can I force Text tag in android to write "ltr" ???
simple examble
========>>>> file Texttest.js =======================>>>
import React from 'react';
import { Text, View } from 'react-native';
class TextTest extends React.Component {
render() {
return (
<View style={{ alignContent: "center", alignSelf: "stretch", alignItems: "stretch", flex: 1 }}
>
<Text style={{
fontSize: 35, alignSelf: "center", writingDirection: "ltr"
}} >
{"محمد play football"}
</Text>
</View>
)
}
}
export default TextTest;
I'm working on my react native application and i'm sending push notifications using firebase :
in my component i imported librairies :
import firebase from '@react-native-firebase/app'
import messaging from '@react-native-firebase/messaging'
I add native configuration to receive notification in foreground and background mode for IOS and Android.
Now i want to add a click action to redirect to specific component .
I use Postman to send POST request with custom data :
{
"to" : "ceWTvUKphPk:APA91bG6CMyiHZfNnpIs76QyThECegzztWe5hjp05jrKU8ImyWwarprqRYFlY3Hry_Xbv0EV0W76PEgHf7ssMzJbaTOzGvmoZthZnWOm9ZGcpwtZ0ubcHY-ps-9yl-sdM-aGrh1bGbrn",
"notification" : {
"body" : "un nouveau partage",
"title" : "un partage de contact reçu",
"priority" : "high",
"vibration":true,
"sound": "Enabled",
"badge":1,
"requireInteraction": true,
"click_action": "ACTION",
},
"data" : {
"body" : "nouvelle opportunité",
"title" : "un nouveau partage""content_available" : true,
"priority" : "high",
}
}
How can i create a click action and handle this action for both IOS and Android