簡體   English   中英

無法加載 providerinstaller 模塊:找不到可接受的模塊。 本地版本為0,遠程版本為0報錯flutter

[英]Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0 error flutter

我在運行控制台中收到此警告。 基本上,我的 chatRoomTile 沒有顯示在屏幕上。 它只是顯示空白屏幕,即使在我與 10 個人聊天之后也是如此。

它只顯示主屏幕和紅色容器 2 秒,如條件語句所示。

這是運行中的 output -

Performing hot restart...
Syncing files to device sdk gphone x86...
Restarted application in 1,522ms.
W/eyansh.whatsap( 6057): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)
W/DynamiteModule( 6057): Local module descriptor class for providerinstaller not found.
I/DynamiteModule( 6057): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller( 6057): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
Lost connection to device.

這是我的代碼 -

import 'package:flutter/material.dart';
import 'package:whatsapp/helper/authenticate.dart';
import 'package:whatsapp/helper/constants.dart';
import 'package:whatsapp/helper/helperFunctions.dart';
import 'package:whatsapp/screens/search.dart';
import 'package:whatsapp/services/auth.dart';
import 'package:whatsapp/services/database.dart';

class ChatRoom extends StatefulWidget {
  @override
  _ChatRoomState createState() => _ChatRoomState();
}

class _ChatRoomState extends State<ChatRoom> {

  AuthMethods authMethods = new AuthMethods();
  DatabaseMethods databaseMethods = new DatabaseMethods();
  Stream chatRoomStream;

  Widget chatRoomList(){
    return StreamBuilder(
      stream: chatRoomStream,
      builder: (context, snapshot) {
        return snapshot.hasData ? ListView.builder(
        itemCount: snapshot.data.documents.length,
        itemBuilder: (context, index) {
          return ChatRoomTile(
              snapshot.data.documents[index]["chatRoomId"],
          );
       }) : Container(color: Colors.red,);
      },
    );
  }

  @override
  void initState() {
   getUserInfo();
    super.initState();
  }

  getUserInfo() async{
    Constants.myName = await HelperFunctions.getUserNameSharedPreference();
    databaseMethods.getChatRooms(Constants.myName).then((val){
      setState(() {
        chatRoomStream = val;
      });
    });
    setState(() {

    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Color(0xff161517),
          title: Text(
            'WhatsApp',
            style: TextStyle(
              color: Colors.white54,
              fontSize: 20.0,
            ),
          ),
          actions: [
            Container(
              height: 25.0,
              width: 25.0,
              child: FloatingActionButton(
                heroTag: "btn1",
                backgroundColor: Color(0xff161517),
                child: Icon(Icons.search, color: Colors.white54,),
                onPressed: (){
                },
              ),
            ),
            GestureDetector(
              onTap: (){
                authMethods.signOut();
                Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Authenticate()));
              },
              child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 15.0),
                  child: Icon(
                    Icons.exit_to_app,
                    color: Colors.white54,
                  ),
              ),
            ),
            GestureDetector(
              onTap: (){
              },
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 1.0),
                child: Icon(
                  Icons.more_vert,
                  color: Colors.white54,
                ),
              ),
            ),
          ],
        ),
        body: chatRoomList(),
        floatingActionButton: FloatingActionButton(
          heroTag: "btn2",
          backgroundColor: Colors.green[700],
          onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context) => SearchScreen()));
          },
          child: Icon(
            Icons.message,
            color: Colors.white,
          ),
        ),
      ),
    );
  }
}

class ChatRoomTile extends StatelessWidget {

  final String userName;
  ChatRoomTile(this.userName);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        children: [
          Container(
            decoration: BoxDecoration(
              shape: BoxShape.circle,
               image: DecorationImage(
                  image: AssetImage("assets/images/DefaultPhoto.png"),
                  fit: BoxFit.fill,
               ),
              borderRadius: BorderRadius.circular(40.0),
            ),
          ),
          SizedBox(width: 8.0,),
          Text(
            userName,
            style: TextStyle(
              color: Colors.white,

            ),
          ),
        ],
      ),
    );
  }
}

如果有人想要任何小部件的詳細信息,可以問我。

<application>啟動之前,將以下權限添加到android/app/src/main/AndroidManifest.xml

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

我有同樣的錯誤。 我查看了我的代碼,發現我在調用 firebasefirestore 時給出了錯誤的集合名稱。 請務必檢查您是否為集合和文檔提供了正確的參考名稱。

當無線處於活動狀態但與 Firestore 的連接失敗時,我會看到此錯誤。 例如,在調試時我連接到本地模擬器,如果我忘記啟動模擬器,我會收到此消息,但該應用程序仍然可以從緩存中運行。

只要確保你從firestore為我調用了正確的實例名稱我在instace中調用了醫葯產品,我已經在firebase數據庫中定義了MedicineProductData,因此將其更正為MedicineProductData解決了我的問題

代碼:QuerySnapshot 值 = 等待 FirebaseFirestore.instance.collection("MedicineProductData").get();

是的,我解決了這個問題。 我也遇到過這個問題。

為什么會來? 這是因為您的模擬器沒有互聯網連接。 雖然它顯示wifi連接。

解決方案:

  1. 首先檢查您的互聯網連接狀態。
  2. 轉到模擬器並關閉wifi,然后再次打開wifi。 而已。

希望 insa allah 它也對你有用。

也不要忘記將以下代碼添加到清單

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<android>之前

module.exports = {
parser: "vue-eslint-parser",
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"google",
],
rules: {
quotes: ["error", "double"],
},
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM