关于导入react native项目导致运行异常的那些事
从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无法连接,把这个换成阿里的镜像地址之后,项目运行的时候没有卡了。
结语:
项目重导运行报错,错误原因主要有:
- 运行环境不支持(jkd,sdk等)
- 无法下载配置(科学上网或者使用国内镜像)
- 缺少文件(有些文件证书或者加密文件只有在项目上线才提供,提交到仓库文件会被忽略而导致无法运行)
关于导入react native项目导致运行异常的那些事的更多相关文章
- React Native 项目运行在 Web 浏览器上面
React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...
- 安装android Studio和运行react native项目(基础篇)
ANDROID_HOME环境变量 确保ANDROID_HOME环境变量正确地指向了你安装的Android SDK的路径. 打开控制面板 -> 系统和安全 -> 系统 -> 高级系统设 ...
- 【腾讯Bugly干货分享】React Native项目实战总结
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/577e16a7640ad7b4682c64a7 “8小时内拼工作,8小时外拼成长 ...
- React Native 项目实战-Tamic
layout: post title: React Native 项目实战 date: 2016-10-18 15:02:29 +0800 comments: true categories: Rea ...
- React Native 项目整合 CodePush 全然指南
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/y4x5M0nivSrJaY3X92c/article/details/81976844 作者 | 钱 ...
- Expo大作战(三)--针对已经开发过react native项目开发人员有针对性的介绍了expo,expo的局限性,开发时项目选型注意点等
简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...
- 第一个React Native项目
1>下图操作创建第一个React Native项目: 用Xcode运行界面如下: 记住: 在使用项目文件期间,终端记住不要关闭的哟!!! 改变了程序代码,需要刷新运行,使用快捷键: Comman ...
- 技术实践丨React Native 项目 Web 端同构
摘要:尽管 React Native 已经进入开源的第 6 个年头,距离发布 1.0 版本依旧是遥遥无期."Learn once, write anywhere",完全不影响 Re ...
- react native项目启动需要做的操作
一.启动: 1.查看端口(默认8081是否被占用) netstat -ano 可以查看所有的进程 2.netstat -ano | findstr "8081" 查看某个端口 ...
- React Native项目集成iOS原生模块
今天学习一下怎么在React Native项目中集成iOS原生模块,道理和在iOS原生项目中集成React Native模块类似.他们的界面跳转靠的都是iOS原生的UINavigationContro ...
随机推荐
- phpstorm配置laravel语法提示
摘自:https://cloud.tencent.com/developer/article/1426699 phpstorm配置laravel语法提示 2019-05-15阅读 1930 用习惯 ...
- nginx37条优化
nginx优化: 1. cpu:核心配置 方法1: worker_processes auto; 自动调用[推荐] 方法2: worker_processes 4; 手工配置 检查CPU核心:yum ...
- 微软官方开源免费的Blazor UI组件库 - Fluent UI Blazor
前言 今天大姚给大家分享一个由微软官方开源(MIT License).免费的Blazor UI组件库:Fluent UI Blazor. 全面的ASP.NET Core Blazor简介和快速入门 F ...
- vue饼图
结果图 原型 1 <template> 2 <!-- 左右柱状图 --> 3 <div ref="rankEcharts" :style=" ...
- rust 程序设计笔记(1)
简介 - Rust 程序设计语言 简体中文版 hello world & rust相关工具使用 hello world rustc rustc --version complie .rs pr ...
- MyBatis 的在使用上的注意事项及其辨析
1. MyBatis 的在使用上的注意事项及其辨析 @ 目录 1. MyBatis 的在使用上的注意事项及其辨析 2. 准备工作 3. #{ } 与 ${ } 的区别和使用 {} 3.1 什么情况下必 ...
- WebStorm 中自定义文档注释模板
WebStorm 中自定义文档注释模板 前提 使用WebStrom写HTML,JavaScript,进行头部注释. 减少重复劳动 养成良好的代码习惯,规范化代码,规范的注释便于后续维护. 头部注释内容 ...
- java8 多条件的filter过滤
java8 多条件的filter过滤 package com.example.core.mydemo.java; import java.io.Serializable; import java.ti ...
- 阿里云OSS图片上传和显示注意点
1. java.lang.IllegalArgumentException: The object key "/image-业务名称/20230818/20230818-订单号参数-acci ...
- python安装pywifi
1.Windows安装: 在Dos窗口中输入以下命令: pip install pywifi 如果找不到pip命令,那么需要将Python安装文件夹下Scripts文件夹的绝对路径加入环境变量中. 2 ...