首页 > 解决方案 > SERVICE_MISSING/SERVICE_DISABLED 错误 - react-native-youtube

问题描述

我正在尝试使用该react-native-youtube包在我的应用程序中显示 youtube 视频。当我尝试将 youtube 视频呈现到屏幕上时,我收到以下弹出窗口:

在此处输入图像描述

github README 说明了这一点:

重要的!(仅限 Android):此组件的 Android 实现需要在设备上安装官方 YouTube 应用程序。否则将提示用户安装/激活应用程序,并使用 SERVICE_MISSING/SERVICE_DISABLED 触发错误事件。

首先,我确信最新版本的 YouTube 应用程序已安装在我的模拟器上。需要注意的是,我在真正的 Amazon Fire Stick 上尝试了这个并且遇到了同样的问题。此链接说明 Android 11 要求您在AndroidManifest.xml要引用的包中指明。我已经尝试了那里的所有建议,但没有成功。

这是我目前的AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.digitalsignageplayer">
  
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.screen.portrait" android:required="false"/>
  <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>

我的编译和目标 SDK:

ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        ndkVersion = "20.1.5948944"
    }

标签: androidreact-nativeyoutubeandroid-tvamazon-fire-tv

解决方案


推荐阅读