从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. Linux下的物理CPU和逻辑CPU

    1.物理CPU (1)物理CPU是指:机器中插槽上的实际CPU个数. (2)物理CPU的数量:可以通过不重复的physical id来查询. (3)命令: cat /proc/cpuinfo | gr ...

  2. 最全SpringBoot日志配置-按照日期和日志级别进行归档

    指定日志文件路径 在 spring的配置文件中配置: logging: config: classpath:logback.xm 日志配置 <?xml version="1.0&quo ...

  3. python安装OCR识别库

    (1)安装过程 参考的这个博客:https://blog.csdn.net/lanxianghua/article/details/100516187?depth_1-utm_source=distr ...

  4. pandas基础--数据结构:索引对象

    pandas含有是数据分析工作变得更快更简单的高级数据结构和操作工具,是基于numpy构建的. 本章节的代码引入pandas约定为:import pandas as pd,另外import numpy ...

  5. OpenTelemetry Logging 思维导图,收藏

    Log 是最常用.最自然的监控数据类型之一,具有以下的优点: 日志的内容比指标更加丰富,可以提供更多的细节信息,帮助开发人员和运维人员更好地理解应用程序的运行状况,通过日志几乎可以重现.还原系统的完整 ...

  6. .Net Core+NPOI快速导入导出Excel

    Excel导入导出在开发中是非常常见的,对Excel操作,NPOI使用的是最常用的,但单单用NPOI,要写得代码还是比较多的,可以借助一个Npoi.Mapper库,操作起来就非常简单了,十来行代码就可 ...

  7. 记Codes 重新定义 SaaS模式开源免费研发项目管理平台——多事项闭环迭代的创新实现

    1.简介 Codes 重新定义 SaaS 模式 = 云端认证 + 程序及数据本地安装 + 不限功能 + 30 人免费 Codes 是一个 高效.简洁.轻量的一站式研发项目管理平台.包含需求管理,任务管 ...

  8. 修改Oracle数据表空间存储位置

    查看数据文件的存储路径: SQL> select name from v$datafile; NAME --------------------------------------------- ...

  9. nginx中多个server块共用upstream会相互影响吗

    背景 nginx中经常有这样的场景,多个server块共用一个域名. 如:upstream有2个以上的域名,nginx配置两个server块,共用一个upstream配置. 那么,如果其中一个域名发生 ...

  10. STP生成树协议详解

    看了网上关于STP生成树的解释感觉不是很懂,随即自己研究了一番 如有错误,欢迎指正,欢迎留言 ----------------------------------------------------- ...