= array(); } $post['classname'] = 'post'; } function comment_format(&$post) { global $conf, $uid, $gid, $forumlist; if (empty($post)) return; $forum = $post['fid'] ? forum_read($post['fid']) : ''; $thread = well_thread_read_cache($post['tid']); if ($thread) { //$post['fid'] = $thread['fid']; $post['closed'] = $thread['closed']; $post['subject'] = $thread['subject']; $post['url'] = $thread['url']; } else { $post['closed'] = 0; $post['subject'] = lang('thread_not_exists'); $post['url'] = ''; } $post['create_date_fmt'] = humandate($post['create_date']); //$post['message'] = stripslashes(htmlspecialchars_decode($post['message'])); $user = user_read_cache($post['uid']); $post['username'] = array_value($user, 'username'); $post['user_avatar_url'] = array_value($user, 'avatar_url'); $post['user'] = $user ? user_safe_info($user) : user_guest(); isset($post['floor']) || $post['floor'] = 0; // 权限判断 $post['allowupdate'] = 2 == array_value($forum, 'comment', 0) && ($uid == $post['uid'] || forum_access_mod($post['fid'], $gid, 'allowupdate')); $post['allowdelete'] = group_access($gid, 'allowuserdelete') && $uid == $post['uid'] || forum_access_mod($post['fid'], $gid, 'allowdelete'); $post['user_url'] = url('user-' . $post['uid'] . ($post['uid'] ? '' : '-' . $post['pid'])); if ($post['files'] > 0) { list($attachlist, $imagelist, $filelist) = well_attach_find_by_pid($post['pid']); // 使用图床 评论使用图床,mysql会过多,写死链接到内容是减轻mysql的过多的方法 if (2 == $conf['attach_on']) { foreach ($imagelist as $key => $attach) { $url = $conf['upload_url'] . 'website_attach/' . $attach['filename']; // 替换成图床 $post['message'] = FALSE !== strpos($post['message'], $url) && $attach['image_url'] ? str_replace($url, $attach['image_url'], $post['message']) : $post['message']; } } $post['filelist'] = $filelist; } else { $post['filelist'] = array(); } $post['classname'] = 'post'; } function comment_format_message(&$val) { global $conf; if (empty($val)) return; // 使用云储存 if (1 == $conf['attach_on'] && 1 == $val['attach_on']) { $val['message'] = str_replace('="upload/', '="' . file_path($val['attach_on']), $val['message']); } elseif (2 == $conf['attach_on'] && 2 == $val['attach_on']) { // 使用图床 list($attachlist, $imagelist, $filelist) = well_attach_find_by_tid($val['tid']); foreach ($imagelist as $key => $attach) { $url = $conf['upload_url'] . 'website_attach/' . $attach['filename']; // 替换成图床 $val['message'] = FALSE !== strpos($val['message'], $url) && $attach['image_url'] ? str_replace($url, $attach['image_url'], $val['message']) : $val['message']; } } else { $val['message'] = str_replace('="upload/', '="' . file_path($val['attach_on']), $val['message']); } //$val['message'] = stripslashes(htmlspecialchars_decode($val['message'])); } // 把内容中使用了云储存的附件链接替换掉 function comment_message_replace_url($pid, $message) { global $conf; if (0 == $conf['attach_on']) { $message = FALSE !== strpos($message, '="../upload/') ? str_replace('="../upload/', '="upload/', $message) : $message; $message = FALSE !== strpos($message, '="/upload/') ? str_replace('="/upload/', '="upload/', $message) : $message; } elseif (1 == $conf['attach_on']) { // 使用云储存 $message = str_replace('="' . $conf['cloud_url'] . 'upload/', '="upload/', $message); } elseif (2 == $conf['attach_on']) { // 使用图床 评论使用图床,mysql会过多,写死链接到内容是减轻mysql的过多的方法 list($attachlist, $imagelist, $filelist) = well_attach_find_by_pid($pid); foreach ($imagelist as $key => $attach) { $url = $conf['upload_url'] . 'website_attach/' . $attach['filename']; // 替换回相对链接 $message = $attach['image_url'] && FALSE !== strpos($message, $attach['image_url']) ? str_replace($attach['image_url'], $url, $message) : $message; } } return $message; } function comment_filter($val) { unset($val['userip']); return $val; } function comment_highlight_keyword($str, $k) { $r = str_ireplace($k, '' . $k . '', $str); return $r; } // //
function comment_message_format(&$s) { if (xn_strlen($s) < 100) return; $s = preg_replace('#.*?
#is', '', $s); $s = str_ireplace(array('
', '
', '
', '

', '', '', '', '' . ''), "\r\n", $s); $s = str_ireplace(array(' '), " ", $s); $s = strip_tags($s); $s = preg_replace('#[\r\n]+#', "\n", $s); $s = xn_substr(trim($s), 0, 100); $s = str_replace("\n", '
', $s); } // 对内容进行引用 function comment_quote($quotepid) { $quotepost = comment_read($quotepid); if (empty($quotepost)) return ''; $uid = $quotepost['uid']; $s = $quotepost['message']; $s = comment_brief($s, 100); $userhref = url('user-' . $uid); $user = user_read_cache($uid); $r = '
' . $user['username'] . ' ' . $s . '
'; return $r; } // 获取内容的简介 0: html, 1: txt; 2: markdown; 3: ubb function comment_brief($s, $len = 100) { $s = strip_tags($s); $s = htmlspecialchars($s); $more = xn_strlen($s) > $len ? ' ... ' : ''; $s = xn_substr($s, 0, $len) . $more; return $s; } ?>javascript - react native build error: Unable to determine the current character, it is not a string, number, array, or object -
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - react native build error: Unable to determine the current character, it is not a string, number, array, or object -

programmeradmin18浏览0评论

This is the error I got:

FAILURE: Build failed with an exception.

* Where:
Script 'D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 191

* What went wrong:
A problem occurred evaluating settings 'XXX'.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'E' with an int value of 69
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  Error: Attribute without valueLine: 26Column: 41Char: i    
at error (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:651:10)    
at strictFail (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:677:7)    
at SAXParser.write (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:1340:13)    
at new XmlDocument (D:\Mobile Projects\XXX\XXX\XXX\node_modules\xmldoc\lib\xmldoc.js:261:15)
at readManifest (D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\build\config\readManifest.js:38:10)
at Object.projectConfig (D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\build\config\index.js:59:46)    
at Object.get project [as project] (D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\index.js:134:65)    
at D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\config\config.js:8:452
at Array.forEach (<anonymous>)
at _objectSpread (D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\config\config.js:8:392)

This is the error I got:

FAILURE: Build failed with an exception.

* Where:
Script 'D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 191

* What went wrong:
A problem occurred evaluating settings 'XXX'.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'E' with an int value of 69
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  Error: Attribute without valueLine: 26Column: 41Char: i    
at error (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:651:10)    
at strictFail (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:677:7)    
at SAXParser.write (D:\Mobile Projects\XXX\XXX\XXX\node_modules\sax\lib\sax.js:1340:13)    
at new XmlDocument (D:\Mobile Projects\XXX\XXX\XXX\node_modules\xmldoc\lib\xmldoc.js:261:15)
at readManifest (D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\build\config\readManifest.js:38:10)
at Object.projectConfig (D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\build\config\index.js:59:46)    
at Object.get project [as project] (D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\index.js:134:65)    
at D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\config\config.js:8:452
at Array.forEach (<anonymous>)
at _objectSpread (D:\Mobile Projects\XXX\XXX\XXX\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\config\config.js:8:392)

Here is package.json:

{
  "name": "XXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "postinstall": "patch-package",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.1",
    "@react-native-community/cli-platform-android": "^2.9.0",
    "@react-native-community/netinfo": "^4.1.5",
    "native-base": "^2.13.5",
    "patch-package": "^6.1.2",
    "react": "^16.9.0",
    "react-native": "^0.60.5",
    "react-native-deep-linking": "^2.2.0",
    "react-native-image-gallery": "^2.1.5",
    "react-native-image-picker": "^1.0.1",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-modal-filter-picker": "^1.3.4",
    "react-native-popup-dialog": "^0.18.3",
    "react-native-spinner-button": "^1.0.3",
    "react-native-swiper": "^1.5.14",
    "react-navigation": "^3.11.1",
    "react-scripts": "^3.1.1",
    "set-cookie-parser": "^2.3.8"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.8.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^6.1.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-native-gesture-handler": "1.0.16",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

This project was able to be built a couple of days ago. However, without any changes, I face the aforementioned error.

I googled and found the following pages:

react-native run-android: daemon startup failed

can't compile and run my react native app

I did tried both of them, but none of them worked.

Any Ideas??????

Share Improve this question asked Sep 1, 2019 at 7:48 Ata IravaniAta Iravani 2,2067 gold badges31 silver badges41 bronze badges 3
  • did you try deleting the signing file? app\build\intermediates\signing_config\debug\out\signing-config.json – X3R0 Commented Sep 1, 2019 at 7:58
  • also did you try closing the cli tool and all open files, and closing the server, then emptying the build folder. then rebuilding it? – X3R0 Commented Sep 1, 2019 at 7:59
  • 1 the links I mentioned in question, suggested your solutions. I did the same, I even delete the whole build folder. Still no changes in error. – Ata Iravani Commented Sep 1, 2019 at 8:04
Add a comment  | 

9 Answers 9

Reset to default 14

Solution 1: Delete the android/app/build folder and try to build again. It should work

Solution 2: run npm i --save @react-native-community/cli-platform-android

  1. First make sure your are on cmd admin
  2. run cd android && gradlew clean
  3. If it give you error while gradlew clean then goto project/android/app/build/intermediates/ and delete signing_config folder
  4. run gradlew clean
  5. run react-native run-android

Most likely some of your dependencies changed, made a big update and overrode some of your dependencies. So, do the following:

  1. Remove all your ^ from the package.json. That is saying to NPM or YARN that is OK to update to a more updated version of your packages. Usually, you don't want that as this might happen.

  2. Nuke your node_modules and re install everything.

Delete ./android/app/build/ folder And try to run again. Worked for me

Try updating the Node to the version 10.17.0. It helped me.

I was getting same error because this line was missing in manifest file

 xmlns:android="http://schemas.android.com/apk/res/android" 

Close your IDE, and run the cmd as administrator to compile the project

I fixed this problem with this steps:

  • Remove the folder /node_modules
  • Run yarn install or npm install
  • From android studio, select Build/Clean Project

After trying what they say and it didn't work, I went back to the latest version of the git, ran npm install, and it ran perfectly.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论