当前位置: 首页 > 知识库问答 >
问题:

颤振:在通道插件上找不到方法getApplicationDocumentsDirectory的实现。颤振io/path\U提供程序

司英彦
2023-03-14

我在这里得到这个错误。并且,试图解决它。

>

E/flatter(14838):[错误:flatter/lib/ui/ui_dart_state.cc(177)]未处理的异常:缺少PluginException(在通道插件上找不到方法getApplicationDocumentsDirectory.flatter.io/path_provider的实现)E/flatter(14838):\0 GetStorage_初始化(包:get_storage/src/storage_impl.dart:47:7)E/flatter(14838):E/flatter(14838):#1个新的GetStorage_内部的(包装:get#u storage/src/storage_impl.dart:27:7)E/Flatter(14838):E/Flatter(14838):#2 main(包装:FlatterApp/main.dart:33:3)E/Flatter(14838):E/Flatter(14838):

主要活动。kt

package com.example.sp

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

生成插件注册。JAVA

package io.flutter.plugins;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;


@Keep
public final class GeneratedPluginRegistrant {
  public static void registerWith(@NonNull FlutterEngine flutterEngine) {
    ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
    flutterEngine.getPlugins().add(new io.flutter.plugins.connectivity.ConnectivityPlugin());
      com.roughike.facebooklogin.facebooklogin.FacebookLoginPlugin.registerWith(shimPluginRegistry.registrarFor("com.roughike.facebooklogin.facebooklogin.FacebookLoginPlugin"));
    flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
    flutterEngine.getPlugins().add(new com.baseflow.geolocator.GeolocatorPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.googlemaps.GoogleMapsPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.googlesignin.GoogleSignInPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
    flutterEngine.getPlugins().add(new dev.flutter.plugins.integration_test.IntegrationTestPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
    flutterEngine.getPlugins().add(new com.aboutyou.dart_packages.sign_in_with_apple.SignInWithApplePlugin());
    flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin());
    flutterEngine.getPlugins().add(new io.flutter.plugins.videoplayer.VideoPlayerPlugin());
  }
}

新闻中心

dependencies:
  flutter:
    sdk: flutter
  get: ^3.22.2
  custom_splash: ^0.0.2
  http: ^0.12.2
  provider: ^4.3.2+2
  google_fonts: ^1.1.1
  flutter_slidable: ^0.5.7
  get_storage: ^1.3.2
  # background_fetch: ^0.6.0
  video_player: ^1.0.1
  modal_bottom_sheet: ^1.0.0+1
  socket_io_client: ^0.9.12
  google_sign_in: ^4.5.6
  url_launcher: ^5.7.10
  animations: ^1.1.2
  shared_preferences: ^0.5.12+4
  sign_in_with_apple: ^2.5.4
  connectivity: ^2.0.2
  image_picker: ^0.6.7+14
  google_maps_flutter: ^1.0.6
  splash_screen_view: ^1.0.3
  flutter_facebook_login: ^3.0.0
  fab_circular_menu: ^1.0.0
  liquid_pull_to_refresh: ^2.0.0
  font_awesome_flutter: ^8.10.1
  cached_network_image: ^2.4.1
  geolocator: ^6.1.13

iOS运行得非常好,我认为它只与Android相关。我已经做了flattercleanflatterrun。试图将其添加到GeneratedPluginRegistrent。java或我能找到的其他解决方案。

共有1个答案

孟泽宇
2023-03-14

你试过吗Link

我也遇到了类似的问题,但现在可以继续使用getDatabasesPath()而不是getApplicationDocumentsDirectory()

 类似资料: