android 您的主活动类com.ryanheise.audioservice.audioServiceActivity不是一个子类FlutterFragmentActivity

jdzmm42g  于 2022-12-09  发布在  Android
关注(0)|答案(1)|浏览(116)

我正在尝试创建音乐应用程序使用just_audio & just_audio_background插件,应用程序运行正常,但我正在尝试从flutter_stripe插件集成Stripe。我在点击结帐按钮时收到异常。它看起来像just_audio_background中的类com.ryanheise.audioservice.AudioServiceActivity与flutter_stripe插件冲突

异常您的主活动类com.ryanheise.audioservice.AudioServiceActivity不是一个子类FlutterFragmentActivity。
主要活动.kt

package com.example.spotify
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}

安卓清单.xml

``

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.spotify"
    xmlns:tools="http://schemas.android.com/tools">
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.WAKE_LOCK"/>
   <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
   
   <application
        android:label="spotify"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true">
        <activity
            android:name="com.ryanheise.audioservice.AudioServiceActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            
        </activity>

      
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    <service android:name="com.ryanheise.audioservice.AudioService"
        android:foregroundServiceType="mediaPlayback"
        android:exported="true" tools:ignore="Instantiatable">
      <intent-filter>
        <action android:name="android.media.browse.MediaBrowserService" />
      </intent-filter>
    </service>

    <!-- ADD THIS "RECEIVER" element -->
    <receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver"
        android:exported="true" tools:ignore="Instantiatable">
      <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
      </intent-filter>
    </receiver>     
    </application>
</manifest>

`
我尝试自定义活动定义直接进入menifest,但它不工作.请帮助我我是新手

iibxawm4

iibxawm41#

您可以尝试AudioServiceFragmentActivity而不是AudioServiceActivity。有关定义音频服务活动的不同方法的详细信息,请参阅audio_service文档。

相关问题