gpt4 book ai didi

android - 您的主要 Activity 类 com.ryanheise.audioservice.AudioServiceActivity 不是 FlutterFragmentActivity 的子类

转载 作者:行者123 更新时间:2023-12-03 07:59:46 28 4
gpt4 key购买 nike

我正在尝试使用 just_audio 和 just_audio_background 插件创建音乐应用程序,应用程序工作正常,但我正在尝试从 flutter_stripe 插件集成 Stripe。单击结账按钮时出现异常。它看起来像 just_audio_background 中的类 com.ryanheise.audioservice.AudioServiceActivity 与 flutter_stripe 插件冲突

异常您的 Main Activity 类 com.ryanheise.audioservice.AudioServiceActivity 不是 FlutterFragmentActivity 的子类。

MainActivity.kt


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

AndroidManifest.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>

`

我尝试将自定义 Activity 直接定义到menifest中,但它不起作用。请帮助我,我是新手

最佳答案

您可以尝试 AudioServiceFragmentActivity 而不是 AudioServiceActivity。有关定义音频服务 Activity 的不同方法的更多信息,请参阅 audio_service documentation .

关于android - 您的主要 Activity 类 com.ryanheise.audioservice.AudioServiceActivity 不是 FlutterFragmentActivity 的子类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74694631/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com