从git上导入公司的项目,在本地运行的时候,项目无法运行。sdk,jdk,node都是使用公司规定的版本,项目中的local.properties文件sdk.dir路径也换成了自己本地的目录,结果就在react-native run-Android的时候,卡着了,等了一个多小时,报错结果如下:

> Task :jpush-react-native:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
158 actionable tasks: 22 executed, 136 up-to-date
D:\test\app-prd2 (1)\app-prd2 (1)\app\node_modules\jpush-react-native\android\src\main\java\cn\jiguang\plugins\push\JPushModule.java:387: ����: �Ҳ�������
JSONObject notificationExtraJson = new JSONObject(notificationExtra.toHashMap());
^
����: ���� toHashMap()
λ��: ����ΪReadableMap�ı��� notificationExtra
D:\test\app-prd2 (1)\app-prd2 (1)\app\node_modules\jpush-react-native\android\src\main\java\cn\jiguang\plugins\push\JPushPackage.java:13: ����: JPushPackage���dz����, ����δ����ReactPackage�еij���createJSModules()
public class JPushPackage implements ReactPackage {
^
2 ������ FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':jpush-react-native:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 1m 17s error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
D:\test\app-prd2 (1)\app-prd2 (1)\app\node_modules\jpush-react-native\android\src\main\java\cn\jiguang\plugins\push\JPushModule.java:387: ����: �Ҳ�������

出现乱码不用管,一开始觉得是gradle下不下来,就去修改了gradle-wrapper.properties的distributionUrl,改成本地的gradle,结果还是可住一个多小时,卡后报一样的错误。如果有人因为gradle下不下来,可以移步到这个博客:

https://blog.csdn.net/lbb17745169396/article/details/79064394?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242

由于运行卡在:

Resolve dependencies of :app:debugRuntimeClasspath > maven-metadata.xml

想着可能是因为下载依赖的时候,配置的是国外的远程仓库,所以下不下来,所以就去build.gradle文件修改的mavenURL,由于不知道是哪个mavenURL连不上,所以我就把四个URL都改成了阿里的镜像:

maven { url "https://maven.aliyun.com/repository/google"}
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }

配置好之后运行,这次没有卡了,又报了一个错,错误如下:

> Task :app:validateSigningDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
383 actionable tasks: 2 executed, 381 up-to-date FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file 'D:\test\app-prd2 (1)\app-prd2 (1)\app\android\app\hglife.keystore' not found for signing config 'debug'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 22s

这次报错原因倒是简单,看“* What went wrong: ”下面的提示:

Keystore file 'D:\test\app-prd2 (1)\app-prd2 (1)\app\android\app\hglife.keystore' not found for signing config 'debug'.

就是说我的android\app目录下没有hglife.keystore文件,这个文件是Android平台签名证书,要么禁用,要么问公司要一个或者生成(一般的项目hglife.keystore都是自定义的,生成无法直接使用),禁用移步百度。要到文件直接,react-native run-Android后项目就运行起来了。

后面自己也总结,特别是运行卡住哪里,我把报原来的mavenURL注释关掉,然后逐一注释四个URL。

   maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
// // ADD THIS
//原配置
maven { url 'https://www.jitpack.io' }
maven { url 'https://maven.google.com' }

等到我把 maven { url 'https://maven.google.com' }这个URL注释掉,其他三个都打开,项目运行没有卡掉,而是运行报错,我就明白的,是 maven { url 'https://maven.google.com' }这个URL无法连接,把这个换成阿里的镜像地址之后,项目运行的时候没有卡了。

结语:

项目重导运行报错,错误原因主要有:

  1. 运行环境不支持(jkd,sdk等)
  2. 无法下载配置(科学上网或者使用国内镜像)
  3. 缺少文件(有些文件证书或者加密文件只有在项目上线才提供,提交到仓库文件会被忽略而导致无法运行)

关于导入react native项目导致运行异常的那些事的更多相关文章

  1. React Native 项目运行在 Web 浏览器上面

    React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...

  2. 安装android Studio和运行react native项目(基础篇)

    ANDROID_HOME环境变量 确保ANDROID_HOME环境变量正确地指向了你安装的Android SDK的路径. 打开控制面板 -> 系统和安全 -> 系统 -> 高级系统设 ...

  3. 【腾讯Bugly干货分享】React Native项目实战总结

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/577e16a7640ad7b4682c64a7 “8小时内拼工作,8小时外拼成长 ...

  4. React Native 项目实战-Tamic

    layout: post title: React Native 项目实战 date: 2016-10-18 15:02:29 +0800 comments: true categories: Rea ...

  5. React Native 项目整合 CodePush 全然指南

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/y4x5M0nivSrJaY3X92c/article/details/81976844 作者 | 钱 ...

  6. Expo大作战(三)--针对已经开发过react native项目开发人员有针对性的介绍了expo,expo的局限性,开发时项目选型注意点等

    简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...

  7. 第一个React Native项目

    1>下图操作创建第一个React Native项目: 用Xcode运行界面如下: 记住: 在使用项目文件期间,终端记住不要关闭的哟!!! 改变了程序代码,需要刷新运行,使用快捷键: Comman ...

  8. 技术实践丨React Native 项目 Web 端同构

    摘要:尽管 React Native 已经进入开源的第 6 个年头,距离发布 1.0 版本依旧是遥遥无期."Learn once, write anywhere",完全不影响 Re ...

  9. react native项目启动需要做的操作

    一.启动: 1.查看端口(默认8081是否被占用) netstat -ano   可以查看所有的进程 2.netstat -ano | findstr "8081"  查看某个端口 ...

  10. React Native项目集成iOS原生模块

    今天学习一下怎么在React Native项目中集成iOS原生模块,道理和在iOS原生项目中集成React Native模块类似.他们的界面跳转靠的都是iOS原生的UINavigationContro ...

随机推荐

  1. 查看浏览器对html5的支持情况

    http://html5test.com/   视频和音频代码检测 function CheckAudio(){ var myAudio=document.createElement("au ...

  2. Linux之top命令分析

    第一行: top - 04:25:26 当前系统时间 up 3 min, 系统已经运行的时间(不间歇的运行) 1 user, 当前登录系统的用户数 load average: 0.01, 0.03, ...

  3. centos7下启动Django项目报错(sqlite错误)

    报错内容如下: [root@localhost project]# python3 manage.py runserver Watching for file changes with StatRel ...

  4. 如何实现sm3加密

    SM3加密应用 何为sm3加密? SM3是由中国国家密码管理局设计的一种密码杂凑函数,类似于SHA-256和MD5等国际标准的散列算法.SM3算法是中国国家标准<GB/T 32905-2016 ...

  5. Qt工具栏的使用

    参考视频:黑马科技:https://www.bilibili.com/video/BV1XW411x7NU?p=19 对话框通常会是一个顶层窗口,出现在程序最上层,用于实现短期任务或者简洁的用户交互. ...

  6. linux系统下,redis如何设置密码

    1.命令方式 首先查看下密码是否存在,发现并未设置为空. -bash-4.2# cd /usr/local/redis-6.2.6/src -bash-4.2# ./redis-cli 127.0.0 ...

  7. C#.NET 国密 BASE64编码的私钥提取16进制私钥 (锦州银行、建行轻应用)

    C#.NET 国密 BASE64编码的私钥提取16进制私钥 (锦州银行.建行轻应用), 从BASE64编码的公钥中提取16进制字符串公钥, 从BASE64编码的私钥中提取16进制字符串私钥, 锦州银行 ...

  8. EF CORE 遇到“无法打开登录所请求的数据库 "win7bc"。登录失败。”

    报错内容:ex:An exception has been raised that is likely due to a transient failure. Consider enabling tr ...

  9. k8s配置文件管理

    1.为什么要用configMap ConfigMap是一种用于存储应用所需配置信息的资源类型,用于保存配置数据的键值对,可以用来保存单个属性,也可以用来保存配置文件. 通过ConfigMap可以方便的 ...

  10. work07

    day08作业: 必做题:============================================================ 第一题: 定义一个字符串s = "Hell ...