简体   繁体   English

在物理设备崩溃 android 工作室 flutter 上构建 Apk

[英]build Apk on physical device crash android studio flutter

When I build my app on emulator (android 11 API 30) it's working fine, but when I try building on my old physical device (Android Kitkat API 19) It crash.当我在模拟器(android 11 API 30)上构建我的应用程序时,它工作正常,但是当我尝试在我的旧物理设备(Android Kitkat API 19)上构建它时它崩溃了。

Edit: Yes developer options is enabled编辑:是的开发人员选项已启用

But when I run terminal flutter build apk --split-per-abi or flutter run --release it works I can run it on physical device但是当我运行终端flutter build apk --split-per-abiflutter run --release它工作我可以在物理设备上运行它

I know I need armeabi v7 to make it work on my phone but its annoying to have to use console everytime I want to build我知道我需要 armeabi v7 才能让它在我的手机上工作,但是每次我想构建时都必须使用控制台很烦人

Unless I'm doing it wrong how do I build this on my IDE除非我做错了,否则我如何在 IDE 上构建它

Edit 2: Here's my appbuild编辑 2:这是我的 appbuild

minSdkVersion 19

buildTypes {
customDebugType {
        debuggable true
    }

    release {
        minifyEnabled true
        signingConfig signingConfigs.debug
    }

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

You can add a custom run configuration to execute any shell script.您可以添加自定义运行配置来执行任何 shell 脚本。

To do so in Android Studio, go to Run -> Edit Configurations...为此,请在 Android Studio、go 中运行 -> 编辑配置...

Android Studio 编辑配置... 选项

In the configurations window, click the + icon and select Shell Script在配置 window 中,单击 + 图标和 select Shell 脚本

Android Studio 中的配置选项菜单

Once it's added, you can give the script a name and for the "Script Path" select the flutter executable (This can be found inside the flutter SDK folder specifically inside a bin folder). Once it's added, you can give the script a name and for the "Script Path" select the flutter executable (This can be found inside the flutter SDK folder specifically inside a bin folder). For the "Script options", you can add the options you would like Flutter to execute such as build apk --split-per-abi or run --release对于“脚本选项”,您可以添加您希望 Flutter 执行的选项,例如build apk --split-per-abirun --release

Android Studio Shell 脚本选项

At this point, you can click apply and ok.此时,您可以单击应用并确定。 You should now see this custom runner in the drop down menu where you can run different tasks.您现在应该在下拉菜单中看到这个自定义运行器,您可以在其中运行不同的任务。

Android Studio 运行选项下拉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM