开源项目地址如下:
github托管项目地址:https://github.com/LLK/scratchjr
环境配置时相关错误整合解决方案:
根据文档配置:
https://github.com/LLK/scratchjr/blob/develop/README.md
根据相关文档配置后可能会发生babel-loader配置问题,可以查看如下issues
1.https://github.com/LLK/scratchjr/issues/285
2.https://github.com/babel/babel-loader/issues/149
对于三方的配置使用了:Firebase SDK https://firebase.google.com/products/analytics
需要创建应用并进行使用,期间注册应用时,需要使用的包名为:
build.gradle中
productFlavors中的applicationId
否则会出现No matching client found for package name的错误,相关解决文档:https://blog.csdn.net/qq_16624353/article/details/80828181
如果已经使用了别的包名注册了项目,其实也可以直接修改google-services.json文件中的package_name
至此配置问题得到相应解决。
为提高检索准确度,在最后放上几个报错信息:
ERROR in ./src/entry/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Couldn't find preset "react-native" relative to directory "/Users/xxx/Desktop"
at /Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-loader/lib/index.js:50:20)
at Object.module.exports (/Users/xxx/Desktop/RNProject/scratchjr/node_modules/babel-loader/lib/index.js:173:20)
Task :app:generateWebpackBundle FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:generateWebpackBundle'.
Process 'command './bundle-compile.sh'' finished with non-zero exit value 2
No matching client found for package name
注:在解决问题时,需要定位到问题的关键所在。比如在集成项目中检索不到问题出在哪里,极有可能是因为是引用的三方组件出现了问题,定位到相关三方组件进行检索问题的解决方案即可。