首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android-TV应用程序显示白屏

Android-TV应用程序显示白屏
EN

Stack Overflow用户
提问于 2018-08-06 20:38:05
回答 3查看 894关注 0票数 0

我已经用react-native和expo构建了一个应用程序。安装在我的Android电视和Android电视模拟器上。

当我通过ES文件资源管理器应用程序运行它时,这个应用程序可以工作,但是当我试图通过在Android-TV应用程序部分点击它来定期运行它时,我得到一个稳定的白屏。

通过$exp build:android使用expo构建了apk。App.json代码:

代码语言:javascript
复制
 {
  "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

EN

回答 3

Stack Overflow用户

发布于 2019-11-23 04:55:39

在花了一些时间查看本机代码之后,我设法通过向app.json添加适当的配置来解决这个问题:

代码语言:javascript
复制
"android": {
  ...
  "intentFilters": [
    {
      "action": "MAIN",
      "category": [
        "LEANBACK_LAUNCHER"
      ]
    }
  ]
},

更详细的答案可以在这里找到:https://gist.github.com/miazga/2e6449e0c591e3ac8e22185b2edb447d

票数 3
EN

Stack Overflow用户

发布于 2018-08-08 00:43:17

按照本thread中的建议,Go to File -> Setting -> Build,Execution,Deployment -> Instant Run然后取消选中该Enable Instant Run,然后运行该项目。

同样在这个link中,当您的应用程序启动时,它首先使用启动活动的主题来显示窗口背景。如果您不在styles.xml中指定windowBackground,则将使用默认白色,并会损坏UX。

票数 0
EN

Stack Overflow用户

发布于 2021-01-05 01:11:53

到目前为止,Matt的答案似乎已经过时了,它在读取清单时抛出了构建时间错误。

代码语言:javascript
复制
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上进行了测试

还要注意的是,你必须把“启动器”也包括在类别中,否则一些设备可能仍然会显示白屏。

代码语言:javascript
复制
"intentFilters": [
        {
          "action": "MAIN",
          "data":{},
          "category": [
            "LEANBACK_LAUNCHER",
            "LAUNCHER"
          ]
        }
      ]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51707841

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档