Mic*_*ger 2 android reactjs react-native react-native-track-player
在过去 1.5 天左右的时间里,我试图让 React-native-track-player 工作,但我就是无法实现它。无论我尝试什么,我总是会遇到相同的错误块:
\nERROR TypeError: null is not an object (evaluating \'TrackPlayer.RATING_HEART\')\nERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. \n This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.\nRun Code Online (Sandbox Code Playgroud)\n我使用react-native expo和 “正常” react-native(根据react-native docu)设置它。对于我尝试过的所有变体:JSTS
npm cache verify(如此处所述),react-native start --reset-cache(来自此处)以及其他一些缓存重置/删除内容。node)所有这些努力都以完全相同的错误告终。
\n所以,我真的不知道该怎么办了。一般来说,我是反应原生和应用程序开发的初学者。所以说实话,我犯的错误很可能是超级愚蠢/简单的。但我就是找不到它。如果有任何建议,我将非常感激。
\n\n编辑2:解决方案-react-native删除了我所有问题的根源,请检查下面我的答案以了解详细信息jcenter。v0.64 v0.65
编辑:jcenter()肯定会被删除。检查此GitHub 线程,了解有关如何继续使用react-native-track-player.
好吧,虽然从他们的存储库克隆示例有效(感谢@AngwarGul),但我仍然想弄清楚为什么会这样。事实证明,错误的根本原因在于文件中build.gradle。
我一直在使用react-native@0.65.1但不知道 from v0.64to已从react-native中v0.65 jcenter 删除。因此,运行时react-native run-android无法构建应用程序,因为它找不到 jcenter。所以,我可能早就意识到了这一点,但我一直在寻找除了那里之外的任何地方。
TL;DR:添加jcenter()到 build.gradle 文件为我解决了整个问题(见下图)。因此,如果其他人犯了同样的愚蠢错误,这是您的解决方案;)
| 归档时间: |
|
| 查看次数: |
5005 次 |
| 最近记录: |