【问题标题】:build Apk on physical device crash android studio flutter在物理设备崩溃 android studio flutter 上构建 Apk
【发布时间】:2021-07-12 13:53:12
【问题描述】:

当我在模拟器 (android 11 API 30) 上构建我的应用程序时,它运行良好, 但是当我尝试在我的旧物理设备(Android Kitkat API 19)上构建时它崩溃了。

编辑:是的,开发人员选项已启用

但是当我运行终端 flutter build apk --split-per-abiflutter run --release 时,它可以工作 我可以在物理设备上运行它

我知道我需要 armeabi v7 才能让它在我的手机上运行,​​但每次我想构建时都必须使用控制台很烦人

除非我做错了,否则我如何在我的 IDE 上构建它

编辑 2: 这是我的应用构建

minSdkVersion 19

buildTypes {
customDebugType {
        debuggable true
    }

    release {
        minifyEnabled true
        signingConfig signingConfigs.debug
    }

    debug {
        minifyEnabled true
        applicationIdSuffix ".debug"
        debuggable true
    }
    staging {
        initWith debug
        applicationIdSuffix ".debugStaging"
    }

【问题讨论】:

    标签: android flutter android-studio build crash


    【解决方案1】:

    您可以添加自定义运行配置来执行任何 shell 脚本。

    要在 Android Studio 中执行此操作,请转到运行 -> 编辑配置...

    在配置窗口中,单击 + 图标并选择 Shell Script

    添加后,您可以为脚本命名,并为“脚本路径”选择颤振可执行文件(这可以在颤振 SDK 文件夹中找到,特别是在 bin 文件夹中)。对于“脚本选项”,您可以添加您希望 Flutter 执行的选项,例如 build apk --split-per-abirun --release

    此时,您可以单击应用并确定。您现在应该在下拉菜单中看到这个自定义运行器,您可以在其中运行不同的任务。

    【讨论】:

    • 谢谢这是一个快速的解决方法,我还需要在“解释器路径”中包含任何内容吗?
    • @IshakBenaissa 不,你可以留空
    猜你喜欢
    • 2023-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多