Reputation: 121
Hello developers of the world!
I have a persisting issue with using a specific Flutter package for Android and iOS.
MissingPluginException(No implementation found for method getTemporaryDirectory on channel plugins.flutter.io/path_provider)
This raises when I use a function of audioplayers (https://pub.dev/packages/audioplayers).
This is not a story of hot restart. I also tried the solution proposed here https://stackoverflow.com/a/66593064/8791925 but I got no improvement.
The content of my MainActivity.kt is
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
Edit:
I add the content of the pubspec.yaml concerning dependencies
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
# region firebase
firebase_core: "^1.7.0"
firebase_database: "^8.0.0"
cloud_firestore: "^2.5.3"
firebase_messaging: "^10.0.8"
firebase_auth: ^3.1.3
firebase_auth_platform_interface: ^6.1.1
firebase_core_platform_interface: ^4.0.1
# endregion
flutter_signin_button: ^2.0.0
# region internationalisation
flutter_localizations:
sdk: flutter
intl: ^0.17.0
# endregion
# region notification
flutter_local_notifications: ^9.1.5
awesome_notifications: any
flutter_native_timezone: ^2.0.0
# endregion
http: ^0.13.0
shared_preferences: ^2.0.7
uuid: ^3.0.5
device_info: ^2.0.2
# region bloc
flutter_bloc: ^7.3.1
# endregion
formz: ^0.4.0
cache:
path: packages/cache
equatable:
flutter_slidable:
animations:
# region qr code
qr_code_scanner: ^0.6.1
# endregion
# region audio and sound
audioplayers: ^0.20.1
path_provider:
volume_control: ^0.1.5
volume: ^1.0.1
# endregion
# region connectivity
connectivity_plus: "^0.0.1"
# endregion
dev_dependencies:
flutter_test:
sdk: flutter
I also add the content of the Android Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="...">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="..."
android:usesCleartextTraffic="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
tools:targetApi="m">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:windowSoftInputMode="adjustResize"
android:exported="true"
tools:targetApi="o_mr1">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="FIREBASE_NOTIF_ID"/>
<service
android:name="com.dexterous.flutterlocalnotifications.ForegroundService"
android:exported="false"
android:stopWithTask="false"
android:foregroundServiceType="mediaPlayback"/>
</application>
</manifest>
Do you see what I can be missing?
Thank you for your help.
Upvotes: 0
Views: 428
Reputation: 121
I finally found the solution: upgrading packages (flutter pub upgrade
). By chance, the issue was fixed by maintainers of path_provider
. I was in version 2.0.10 when the issue occurs and the version 2.0.11 fixes it.
I tried to do this but only in December, when I got the issue for the first time and it did not solve it at this time.
To understand the origin of the fix, I checked which packages were updated in pubspec.lock. I saw that path_provider_android
was updated and not path_provider
became 'transitive':
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
Then:
path_provider_android
was last updated through the package manager https://pub.dev/packages/path_provider_android,Upvotes: 1