You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter添加谷歌登录后调试安装报错INSTALL_FAILED_INVALID_APK,求解决

Flutter添加谷歌登录后INSTALL_FAILED_INVALID_APK错误解决

添加「使用谷歌继续登录」功能后,调试构建时出现APK安装失败,报错信息如下:

Launching lib/main.dart on sdk gphone16k arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Installing build/app/outputs/flutter-apk/app-debug.apk...
Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install /Users/username/{Project Path}/build/app/outputs/flutter-apk/app-debug.apk: Failure [INSTALL_FAILED_INVALID_APK: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]
Error launching application on sdk gphone16k arm64.

以下是解决步骤:

  • 打开android/app/src/main/AndroidManifest.xml,在<application>标签中添加android:extractNativeLibs="true":
    <application
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:label="your_app_name"
        android:extractNativeLibs="true">
    
  • 清理项目缓存:
    flutter clean
    cd android && ./gradlew clean
    cd ..
    
  • 重新构建并运行:
    flutter run
    

这个错误多是因为谷歌登录依赖引入的原生库无法被系统正确提取,开启extractNativeLibs可强制系统提取原生库,配合清理缓存能消除依赖冲突或旧缓存导致的异常。

内容的提问来源于stack exchange,提问作者Ahammed Nibras

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 09:18:11