我已经用react-native和expo构建了一个应用程序。安装在我的Android电视和Android电视模拟器上。
当我通过ES文件资源管理器应用程序运行它时,这个应用程序可以工作,但是当我试图通过在Android-TV应用程序部分点击它来定期运行它时,我得到一个稳定的白屏。
通过$exp build:android使用expo构建了apk。App.json代码:
{
"expo": {
"name": "CommuniTV",
"description": "The future of watching TV is here!",
"slug": "CommuniTV",
"privacy": "public",
"sdkVersion": "26.0.0",
"platforms": ["ios", "android"],
"version": "1.0.4",
"orientation": "landscape",
"entryPoint": "./App.js",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "project.communiTV.com",
"versionCode": 104,
"permissions": [],
"icon": "./AppIcon.png",
"adaptiveIcon": {
"foregroundImage": "./launcherIcon.png" // size is 1024x1024
}
}
}
}在网上找不到任何解决方案,我被卡住了。
有什么建议吗?First screenshot - I click here I get a white screen
Second screenshot - I'll start it from here the App works fine
发布于 2019-11-23 04:55:39
在花了一些时间查看本机代码之后,我设法通过向app.json添加适当的配置来解决这个问题:
"android": {
...
"intentFilters": [
{
"action": "MAIN",
"category": [
"LEANBACK_LAUNCHER"
]
}
]
},更详细的答案可以在这里找到:https://gist.github.com/miazga/2e6449e0c591e3ac8e22185b2edb447d
发布于 2018-08-08 00:43:17
发布于 2021-01-05 01:11:53
到目前为止,Matt的答案似乎已经过时了,它在读取清单时抛出了构建时间错误。
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at renderIntentFilterDatumEntries (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidIntentFilters.js:33:17)
at /app/turtle/node_modules/@expo/xdl/build/detach/AndroidIntentFilters.js:37:70
at Array.map (<anonymous>)
at renderIntentFilterData (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidIntentFilters.js:37:48)
at /app/turtle/node_modules/@expo/xdl/build/detach/AndroidIntentFilters.js:25:9
at Array.map (<anonymous>)
at renderIntentFilters (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidIntentFilters.js:22:24)
at runShellAppModificationsAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:632:115)
at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:392:3)
at async runShellAppBuilder (/app/turtle/build/builders/android.js:95:9)
at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:43:28)
at async build (/app/turtle/build/jobManager.js:181:33)
at async processJob (/app/turtle/build/jobManager.js:118:32)
at async Object.doJob (/app/turtle/build/jobManager.js:49:5)
at async main (/app/turtle/build/server.js:66:13)我用data property更新了它,现在看起来工作正常,在expo 39和40上进行了测试
还要注意的是,你必须把“启动器”也包括在类别中,否则一些设备可能仍然会显示白屏。
"intentFilters": [
{
"action": "MAIN",
"data":{},
"category": [
"LEANBACK_LAUNCHER",
"LAUNCHER"
]
}
]https://stackoverflow.com/questions/51707841
复制相似问题