从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. golang http client 长连接vs短连接基准测试

    package main import ( "io/ioutil" "net/http" "strings" "testing&q ...

  2. 关于Embedded Resource的理解

    Embedded Resource .NET中使用外部资源时常用的方式都是使用资源文件,作为程序集的一部分发布.资源文件的读取也比较方便,字符串.图片和任何二进制数据,包括任何类型的文件都可以作为资源 ...

  3. 不使用循环语句用if和else实现循环

    如果不使用循环语句,可以使用递归函数来实现循环的效果.递归函数是指在函数内部调用自身的函数.下面是一个使用递归函数来实现循环的示例: (初学者记得写include,这里是个普通函数,所以我没写) de ...

  4. ChatTTS,语气韵律媲美真人的开源TTS模型,文字转语音界的新魁首,对标微软Azure-tts

    前两天 2noise 团队开源了ChatTTS项目,并且释出了相关的音色模型权重,效果确实非常惊艳,让人一听难忘,即使摆在微软的商业级项目Azure-tts面前,也是毫不逊色的. ChatTTS是专门 ...

  5. 异构数据源同步之数据同步 → DataX 使用细节

    开心一刻 中午我妈微信给我消息 妈:儿子啊,妈电话欠费了,能帮妈充个话费吗 我:妈,我知道了,我帮你充 当我帮我妈把话费充好,正准备回微信的时候,我妈微信给我发消息了 妈:等会儿子,不用充了,刚刚有个 ...

  6. JavaSE 关键字和标识符

    目录 关键字 标识符 标识符命名规则 标识符命名规范 字面值 关键字 具有特殊含义的 命名时不可以与关键字重名 标识符 也就是名字,对类名,变量名称,方法名称,参数名称等修饰 标识符命名规则 以字母, ...

  7. 记录nodejs做编辑和新增时候对数据库的操作

    server.js文件 const dao = require("../dao/user.dao"); saveDat是个对象自己处理一下 if (updataFlag) {//编 ...

  8. 红白机基本原理(二) CPU

    CPU 首发公号:Rand_cs NES 使用的 CPU 为 6502,但与标准的 6502 有些许不同,最大的不同在于 NES 使用的芯片拥有一个 pAPU(pseudo-Audio Process ...

  9. 项目管理--PMBOK 读书笔记(3)【项目经理的角色 】

    思维导图软件工具:https://www.xmind.cn/ 源文件地址:https://files-cdn.cnblogs.com/files/zj19940610/项目经理的角色.zip

  10. ThreadLocal本地局部线程demo

    ThreadLocal本地局部线程demo import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Hash ...