如果我包含某个软件包,Flutter android应用程序将在启动时崩溃 [英] Flutter android app crashes upon startup if I include a certain package

查看:61
本文介绍了如果我包含某个软件包,Flutter android应用程序将在启动时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近突然出现了一个问题,例如只需在pubspec.yaml中将"dependency"包含在"location"中,例如

A problem has suddenly recently arisen such that simply by including the dependency in 'location' in pubspec.yaml like e.g.

dependencies:
  flutter:
    sdk: flutter

  location: ^1.2.0  <------------------------ culprit
  firebase_auth: ^0.5.10  
  cloud_firestore: ^0.7.2   

the app crashes immediately upon startup.

位置"包本身在示例应用程序中单独工作. 我目前尚未导入,即未使用位置包中包含的任何功能,但是当我删除该条目时,一切都很好.

The 'location' package itself works when alone in an example app. I am not currently importing i.e. using any of the functionality contained within the location package, yet when I remove the entry, all is well.

不幸的是,没有从观看颤动日志中获得任何线索...

No clues from watching flutter log unfortunately...

推荐答案

我遇到了同样的问题.我所做的就是在应用程序的build.gradle中插入行multiDexEnabled true.像这样:

I was facing the same issue. What I did was insert the line multiDexEnabled true in my build.gradle of app. Like this:

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true //Insert this line
    }

尝试此操作,然后运行命令flutter cleanflutter build apkflutter run.它必须解决您的问题.

Try this and run the commands flutter clean, flutter build apk and flutter run. It must solve your problem.

这篇关于如果我包含某个软件包,Flutter android应用程序将在启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆