[英]Android-TV app shows white screen
我已經用 react-native 和 expo 構建了一個應用程序。 將它安裝在我的 Android-TV 和我的 Android-TV 模擬器上。
當我通過 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
}
}
}
}
在網上找不到任何解決方案,我被卡住了。
有什么建議? 第一個屏幕截圖 - 我點擊這里我得到一個白屏
在花了一些時間查看本機代碼后,我通過向 app.json 添加適當的配置設法解決了這個問題:
"android": {
...
"intentFilters": [
{
"action": "MAIN",
"category": [
"LEANBACK_LAUNCHER"
]
}
]
},
更詳細的答案可以在這里找到:https ://gist.github.com/miazga/2e6449e0c591e3ac8e22185b2edb447d
到目前為止,馬特的答案似乎已經過時了,它在閱讀清單時拋出了構建時間錯誤。
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)
我用數據屬性更新了它,現在似乎工作正常,在世博會 39 和 40 上測試
另請注意,您還必須在類別中包含“LAUNCHER”,否則某些設備可能仍會顯示白屏。
"intentFilters": [
{
"action": "MAIN",
"data":{},
"category": [
"LEANBACK_LAUNCHER",
"LAUNCHER"
]
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.