Reputation: 243
I am creating project in react native for android and tried to install native-base
using the following command npm install native-base --save
. After that when I am linking the library using react-native link
I am getting error as follow.
rnpm-install ERR! ERRPACKAGEJSON No package found. Are you sure this is a React Native project?
Cannot read property '_text' of undefined
TypeError: Cannot read property '_text' of undefined
at SAXParser.parser_text [as ontext] (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/lib/xmldoc.js:235:39)
at emit (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:639:35)
at closeText (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:649:26)
at emitNode (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:643:26)
at SAXParser.write (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:1195:15)
at new XmlDocument (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/lib/xmldoc.js:199:15)
at readManifest (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/android/readManifest.js:20:10)
at Object.projectConfigAndroid [as projectConfig] (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/android/index.js:41:20)
at Object.keys.forEach.key (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/index.js:101:36)
at Array.forEach (<anonymous>)
I followed this documentation http://docs.nativebase.io/docs/GetStarted.html. I am not getting what is the problem. Please help
Package.json
"dependencies": {
"native-base": "^2.12.0",
"react": "16.6.3",
"react-native": "^0.57.7",
"react-native-flash-message": "^0.1.10",
"react-native-linear-gradient": "^2.5.3",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-navigation": "^2.8.0",
"react-native-tab-view": "^1.3.2",
"react-native-vector-icons": "^6.2.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0"
},
Upvotes: 2
Views: 13603
Reputation: 1421
Since react 0.69 linking is not working. The alternative is to install react-native-assets, but this gives me errors with react-native 0.69.4. So I decided to install manually.
For iOS:
Step 1 : Add/Remove fonts to “Resources” folder in xcode project
Note : Just Drag the fonts in xcode “Resources” folder and check “Copy items if needed” . Add to target should be your project.
if files are copied correctly you can see the files in “Copy bundle resources” in “Build phases” tab
Step 2 : Add/Remove fonts in info.plist files in xcode project with key “Fonts provided by application”
For Android:
Step 1 : Add/Remove fonts to android project in following directory
android/app/src/main/assets/
Upvotes: 0
Reputation: 5089
I faced this issue today and what I did was ran these commands to clean the gradle for the project.
1- Go to the root directory of the project.
2- Run cd android
3- Run gradlew clean
4- Run cd..
and then run the link
commands
Upvotes: 0
Reputation: 243
Thank you @AmirGorji @parashKorat for helping me. For me, this problem was coming because I have removed android:roundIcon="@mipmap/ic_launcher_round"
from the manifest file. When I put it again the react-native link
is working. I removed it because after adding my icons it was showing the error of missing a round icon, for temporary I removed that.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.namaztiming">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
I don't know is it a proper solution or not but in my case, it solved the problem.
Upvotes: 1
Reputation: 3345
1-Make sure you've done the npm install native-base --save
in the project directory
2- Try npm i
to fix the problems with dependencies, then commandreact-native run-android
to make sure your dependencies and "node_modules" folder work properly and project can run.
If you don't have 'android' or 'ios' folder you can use command react-native eject
, then link the packages.
3- Write the command react-native link native-base
, this command links exactly native-base package with react native.
However I recommend you to mostly link the packages manually.
You can also try previous version of native base, like v 2.10.0
.
Upvotes: 3