Skip to content

Instantly share code, notes, and snippets.

@KyrosDigital
Last active October 15, 2020 17:22
Show Gist options
  • Save KyrosDigital/67c0c5cd5a37241fec9c3bb7984a152c to your computer and use it in GitHub Desktop.
Save KyrosDigital/67c0c5cd5a37241fec9c3bb7984a152c to your computer and use it in GitHub Desktop.

Here are the best practices for Kyros team

React Native - New Projects

While trying to run the app in release mode on Android, there are potential issue you can run into:

If you see this error: AAPT: error: resource android:attr/colorError not found. follow this post and add this to your android build.gradle file:

subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion = 28
                    buildToolsVersion = "28.0.3"
                }
            }
    }
}

This forces the app to use the specific SDK version for building.

If you see this error: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so result: 0 follow this post and add this line to your app build.gradle file:

implementation 'com.facebook.soloader:soloader:0.9.0+'

This updates the soloader which should solve an issue where JSC-Android wouldn't load (the libhermes error isn't actually correct in this case).

@rabidale
Copy link

Issues Building in Xcode for iOS for RN < 0.6

If you happen to receive an error message stating Unknown argument type '__attribute__' in method -[rctappstate getcurrentappstate:error] ... etc. refer to this post for a fix: facebook/react-native#25146

Also, upgrading to RN 0.59.10 may resolve the issue.

If you are building the project in Xcode for iOS testing, some issues during the build process may occur:

  • If you run into an error trying to use custom fonts/icons (or potentiall other resources in an 'Assets' folder, consider using the following command: react-native link

  • This should import information from the 'Assets' folder into a 'Resources' folder. This 'Resources' folder is what Xcode uses for assets, so if it is not linked up with the correct information, errors may occur.

  • For more information, this article may be helpful: link

  • If you are using Xcode 11 or later and the React Native version in the project is 59.8 or earlier, you may run into an error message like: unknown argument type '__attribute__' in method... you are most likely facing a known issue with debugger code. Here are steps you can follow to implement the 59.9 RN version fix in earlier versions if you cannot updgrade: link (link to the actual file you need to change)

@rabidale
Copy link

Netinfo issues with react-native-meteor:

In node_modules/react-native-meteor/src/Meteor.js, import NetInfo like this:

import NetInfo from '@react-native-community/netinfo';

Then replace lines 92-96 with this:

NetInfo.fetch().then(state => {
      let isConnected = state.isConnected;
      if (isConnected)
        NetInfo.isConnected.addEventListener('connectionChange', isConnected => {
          if (isConnected && Data.ddp.autoReconnect) {
            Data.ddp.connect();
          }
        });
    }).catch(error => {
      console.log(error)
    });

@rabidale
Copy link

If testing a react-native app on a device/simulator using iOS14 or beyond and images are not appearing, follow the tips in this link to edit the react-native node module: facebook/react-native#29279 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment