Problem when linking react-native-vector-icons - react-native

I just started a new react-native project from zero, added react-native-vector-icons, but when i try to link it, I get the following, I have no idea why this is happening, I didn't change anything, it's a clen project.
error Something went wrong while linking. Error: ENOENT: no such file or directory, copyfile 'PROJECTFOLDER/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' -> 'D:\Codes\ReactNative\KosTimer\android\app\src\main\assets\fonts\AntDesign.ttf'
Please file an issue here: https://github.com/react-native-community/react-native-cli/issues
error ENOENT: no such file or directory, copyfile 'PROJECTFOLDER/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' -> 'D:\Codes\ReactNative\KosTimer\android\app\src\main\assets\fonts\AntDesign.ttf'
Because of this error, all my icons appear with a X inside a square
*PROJECTFOLDER is the place where is my project

The issue is caused by a missing assets/fonts folder inside the android project.
To solve the issue create an assets folder in your project.
Then inside that folder create a folder called fonts.
This is what should have:
<project root>/android/app/src/main/assets/fonts
If you want to do with one command, you can open a terminal at your project root and type:
For mac:
mkdir -p ./android/app/src/main/assets/fonts
For windows:
mkdir ./android/app/src/main/assets/fonts
Then you should be able to link the dependency as normal.

Related

The SDK directory 'C:\Users\ABC\AppData\Local\Android\Sdk\platform-tools;C:\Users\ABC\AppData\Local\Android\Sdk' does not exist

Could somebody help me fix this problem?
When I run react-native run-android in CMD Windows OS, I got this error.
A problem occurred configuring project ':app'.
The SDK directory 'C:\Users\ABC\AppData\Local\Android\Sdk\platform-tools;C:\Users\ABC\AppData\Local\Android\Sdk' does not exist.
I searched everything to fix it but not successful.
I created local.properties in android dir and add this: sdk.dir = C:\\Users\\ABC\\AppData\\Local\\Android\\Sdk
Create ANDROID_HOME variable: C:\Users\ABC\AppData\Local\Android\Sdk and add to path: ...%ANDROID_HOME%platforms;%ANDROID_HOME%platform-tools
but no luck.
Please help.
You can also set android path from CMD.
set ANDROID_HOME=C:\Users\yourusername\AppData\Local\Android\sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Note: You have to run these two commands every time you open new instance of your CMD
If you have the same error even after configuring the environment variables like the above answer, Check the local.properties file. Most probably there can be different ANDROID_HOME path.
local.properties file located in the android folder of the react native code base.
After installing of Android studio you need run it first and create your device. (i don't remember how but it helped for me)Untill this done you not have android folder. To watch my suggestion open C:\Users\yourusername\AppData\Local
and go to your Local folder
mark 'View/show-hide/hidden items' in as on the pictures.
Then open android studio, and create android device.And you will see how hidden android folder have appeared(can be seen if hidden items marked)

Error when add image to project

I created a project and then added an image in the project root directory.
In my index.android.js I added:
When run react-native run android, the error is displayed:
error: bundling failed: "Unable to resolve module ./my-icon.png from C:\\Users\\Ayala\\Documents\\Developer\\React\\BrunoDantas\\index.android.js: could not resolve `C:\Users\Ayala\Documents\Developer\React\BrunoDantas\my-icon.png' as a folder: it did not contain a package, nor an index file"
The problem is your path I think your code example is missing. But the problem is that the image is not able to be found.
Currently your code is I believe?
<Image source={require('./my-icon.png')} />
This means the image should be in the same folder as your index.android.js which I'm guessing it's not... We would need more information in order to tell you what the real problem is.

Compiling react-native project in android

when I try to compile my project in RN 0.35 using my terminal I receive this error:
What went wrong:
Could not list contents of '/MyProject/node_modules/.bin/detect-newline'. Couldn't follow symbolic link.
Any help?
UPDATED
Seems that the cli.js file was missed in the detect-newline folder.
I created a new project and then I have copied the cli.js file, after that everything worked fine.

react-native-maps iOS error

Trying to add airbnb/react-native-maps to my react native project and follow the guide at https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md. Option 1,
Option 1: Cocoapods - Same as the included AirMapsExplorer example
Setup your Podfile like the included example/ios/Podfile then run pod install. (If you do not need GoogleMaps support for iOS, then you can probably completely skip this step.)
Open your project in xCode workspace
Drag the following folder into your project:
node_modules/react-native-maps/ios/AirMaps/
If you need GoogleMaps support also drag this folder into your project:
node_modules/react-native-maps/ios/AirGoogleMaps/
After done, I cannot run the project in Xcode, it gives the error, 'RCTImageLoader.h' file not found.
I hv tried run rnpm link and it cannot go through,
rnpm-link info Android module react-native-maps is already linked
rnpm-link info Linking react-native-maps ios dependency
rnpm-link ERR! It seems something went wrong while linking. Error: ENOENT: no such file or directory, open '/Users/nedved/Desktop/NativeCreditcard_office/node_modules/react-native-maps/ios/AirGoogleMaps.xcodeproj/project.pbxproj'
Please file an issue here: https://github.com/rnpm/rnpm/issues
I can find the file /Users/XXXX/node_modules/react-native-maps/ios/AirGoogleMaps.xcodeproj locally, but when clicking, "Project /Users/XXXX/node_modules/react-native-maps/ios/AirGoogleMaps.xcodeproj cannot be opened because it is missing its project.pbxproj file."
Any idea?

App.js has red background in Titanium Studio. How can I get Titanium to import the project as if it's new?

I have a project that I imported from a shared folder.
Everything worked fine until the hosting computer restarted
After the shared folder was back up I restarted Ti Studio, deleted the project, and imported it again, but it still wouldn't allow me to run the app.
Now there is an asterisk next to the project name so it looks like
this:
* ProjectName [master]
However, before the connection was lost it said [master + 1].
Also there's an asterisk next to app.js, and the background is red:
When I try to run it I get the following error:
[ERROR] : ** BUILD FAILED ** [ERROR] : The following build commands failed:
[ERROR] : Ld build/Debug-iphonesimulator/ProjectName.app/ProjectName normal i386
[ERROR] : (1 failure)
This application worked before I accidentally lost connection to the host folder.
I have also tried cleaning the project.
It seems like Titanium is trying to recover what I saved during the restart, so it won't allow me to run the project again.
TL;DR: How do I make Titanium Studio "forget" this project, and treat it like it's brand new?
UPDATE: I tried deleting the project and creating a new one with the same name, now all the files and folders have an asterisk next to them and the files have a red background. Next I'll try a new name...
UPDATE 2: Naming the project a new name didn't work either. Next I'll try creating a new project locally.
I had to create the project locally. For some reason, after losing the connection, Titanium couldn't hold a connection to the shared folder.
Edit: Here's what I did to get everything back to normal:
I deleted everything locally, on the shared folder, and from the workspace
I created the project locally
copied it to the shared folder
deleted the project from Ti Studio (didn't choose the option to delete the actual files)
then imported the project from the shared folder
Create a file in project root folder name it .gitignore
file contents:
.DS_Store
/app
/build
/plugins
/Resources
/platform
/i18n
build.log
build
CHANGELOG.txt
DefaultIcon-ios.png
DefaultIcon.png
iTunesConnect.png
LICENCE
LICENCE.txt
Manifest
MarketplaceArtwork.png
README
tiapp.xml
npm-debug.log
tmp
.map
.project
.settings
Thumbs.db