Is there a way to determine if the current running react-native app was a debug build? Specifically for android, but hopefully platform agnostic.
Use DEV flag
if (__DEV__) {
console.log('I am in debug');
}
Related
I have a problem trying to run an application made in react-native which uses Flipper in apple silicon, I get the following error:
I tried some things like running Xcode in rosetta mode but it didn't work, I also tried some possible solutions mentioned in this issue, but none of the options worked.
for now, the only thing that has worked is to adjust the react-native.config.js file to prevent auto-linking for Flipper, like so:
module.exports = {
dependencies: {
'react-native-flipper': {
platforms: {
ios: null,
},
},
},
//... other react native configs
};
This option disables Flipper and what I need is to make it work, not to disable it.
Bump the FLIPPER_VERSION variable in android/gradle.properties. as
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.158.0
Then run cd android && ./gradlew clean && cd ..
It will integrate flipper on your project. By using this you need to install flipper to debug an app on your system and then install Sdk on the flipper app. then you can debug your app by using the flipper.
For further explanation, you can visit Here.
I hope this will help you.
Follow the below steps:
Clean everything, use everything based on the M1 build, I mean Xcode, packages, libraries and etc. everything must be based on the M1 build form
Initial an RN project, go to the ios folder, and run this command: arch -x86_64 pod install.
It wouldn't affect your project development source and an Intel base macOS system or other platforms would be able to continue on this source.
I'm working on a project where it is needed to add an specific dependency for a feature on iOS and i would like to avoid to include this library in the android bundle. Is it possible? It isnĀ“t a response to change the name of the android or ios project and run 'react-native link' ;)
The library is react-native-text-detector
I'm not sure if this answers your question but you could do something like
let textDetector;
if(Platform.OS === "ios"){
textDetector = require("react-native-text-detector");
}
And then when you use it just make sure to check if it is not undefined
How to enable debug menu (by shaking device) in Release build in React Native development?
(I am not using Expo)
So the fact that you cannot do this on release is not exactly true. You could do something like this
import { NativeModules } from 'react-native';
...
onMenuButtonClick(){
NativeModules.DevMenu.show();
}
Good practice is to only add the button on DEV but technically you can add this on release as well.
There are other ways of doing this but they are a little more complicated and may not work on both platforms. I cannot current test this but this used to work on both platforms and its pretty easy to set up.
Sorry you can not enable the debug menu in release (production) builds.
Please refer below for more details: http://facebook.github.io/react-native/docs/debugging
I am building a react native application and we're doing the production release.
I noticed that everything works in my iOS app (there's a build phase that generates the offline bundle) but when I run the release build in Android Studio, my app builds but it crashes because it can't find the bundle.
I was able to resolve my own question:
We changed our build types/flavors to match our desired configuration.
The react.gradle file that comes with React Native has a configuration for Debug and Release, these are the common build tasks in a native application. BUT once you change things up you need to tell the react library in android whether or not you want it to bundle for you.
You can find this in your app's build.gradle (under
./android/app/build.gradle). There's an entire block of guidelines commented out that explain you what to do.
In my case I had to add the following code before apply from: "../../node_modules/react-native/react.gradle"
ext.react = [
bundleInNameDebug: false,
bundleInNameBeta: true,
bundleInNameRelease: true
]
NameDebug, NameBeta, NameRelease are all custom BuildTypes/BuildFlavors I have configured.
If you have the signing configuration, it should build a apk for testing when you run react-native run-android --variant=release with the offline bundle. If you want to make a release build for Playstore, run ./gradlew assembleRelease inside the android folder.
You can find more info here
I am experiencing a strange issue with Flutter development and IntelliJ IDEA. I am developing a flutter application with IntelliJ IDEA 2017 1.4 Build number IC-171.4694.23, I am not able to run application on connected Android device, when I run the application, it shows a background process running "Running gradle assembleDebug... " and then the process stops, nothing happens although I was able to run and debug it earlier.
Solution tried,
Disabling/ enabling adb plugin.
Disabling/ enabling developer options and usb debugging.
Re-installing flutter.
I tried with android emulator also, same thing happens. So I think the problem is not with the device. Any help is appreciated.
Update:
This issue happens when I add image_picker plugin to my pubspec.yaml.
dependencies:
flutter:
sdk: flutter
image_picker:
Is flutter run failing with the following error?
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.github.esafirm.android-image-picker:imagepicker:1.5.0.
Required by:
project :app > project :image_picker
> Could not get unknown property 'compileDebugJavaWithJavac' for project ':app' of type org.gradle.api.Project.
If so, you can fix this issue by modifying your build.gradle as described in the image_picker documentation.
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" } // add this line
}
}