世博会没有找到“主要”生产应用中的应用? [英] Expo does not find "main" application in production build?
问题描述
从几周前开始,我一直在尝试纠正此错误,但没有成功。问题是因为这个原因,我无法发布我的应用。
I've been trying to fix this error from a couple weeks ago with no success. The problem is I cannot publish my app because of this.
当我同时为iOS或Android中的任何一个构建博览会应用时,Expo CLI签名过程进行得很好,没有错误并生成最终捆绑包,但是当我将spa或apk文件安装到真实设备中时,它会连续显示启动屏幕4到5次(某种循环),最后显示以下错误消息:
When I build my expo app for any of both, iOS or Android, the Expo CLI signing process goes well, no errors and generates final bundles but when I install the spa or apk file into a real device it shows the splash screen 4 or 5 times in a row (some kind of loop) and finally shows the following error messages:
未检出结果:
https://forums.expo。 io / t / application-main-has-not-been-been-registered / 14395
https://forums.expo.io/t/application-main-has-not-been-been-registered/11753
我的package.json看起来像这样:
My package.json looks like this:
{
"name": "Sxunco",
"homepage": "https://www.sxunco.com",
"version": "1.0.3",
"private": true,
"main": "node_modules/expo/AppEntry.js",
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native|react-clone-referenced-element|expo(nent)?|@expo(nent)?/.*|react-navigation|redux-persist|native-base(-shoutem-theme)|native-base|react-native-router-flux))"
]
},....
我的App.js:
import React from 'react';
import Root from './src/native/index';
import configureStore from './src/store/index';
const { persistor, store } = configureStore();
export default function App() {
return <Root store={store} persistor={persistor} />;
}
我尝试过相同的结果:
- 将
appKey: main
添加到app.json - 添加
AppRegistry.registerComponent('main',()=> App);
进入App.js并同时博览会registerRootComponent(App)
(分开并一起使用,都不起作用) - 将
package.json中的主要路径直接更改为App.js,并使用上述方法$ b注册应用手动$ b
- Adding
"appKey": "main"
into app.json - Adding
AppRegistry.registerComponent(‘main’, () => App);
into App.js and also exporegisterRootComponent(App)
(separated and both together, none of that works) - Changing "main" path in package.json directly to App.js and register app with above methods manually
当我运行build时,我也运行:
When I run build I also run:
exp start --no-dev --minify
所以我等让服务器完成加载,然后运行 expo build:android
So I wait for the server to finish loading and then run expo build:android
请我不知道该怎么做,因此无法发布我的应用。
Please I don't know what to do, I cannot publish my app because of this.
推荐答案
结果是我的App是一个函数,而我只是在传递该函数本身对两种注册方法(反应本机和博览会):
Turns out my App is a function, and I was just passing the function itself to both registration methods (react native & expo):
registerRootComponent(App())
AppRegistry.registerComponent(appName,()=> App());
但是在 registerRootComponent
中我缺少一个箭头函数: S
But in registerRootComponent
I was missing an arrow function :S
registerRootComponent(()=> App())
:)
这篇关于世博会没有找到“主要”生产应用中的应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!