Flutter Android 物理设备应用安装失败:“应用未安装,因为包似乎无效”。

huangapple go评论113阅读模式
英文:

Flutter Android Physical Device App Installation Failing: "App not installed as package appears to be invalid"

问题

I have made an app in Flutter and am trying to install the apk on my physical device.I have done this numerous times in the past but recently I started getting this error when trying to install the apk:

--> "App not installed as package appears to be invalid."

Here are my specs, which hopefully will help:
Phone: Samsung S22+ (Android version 13, last updated Feb 2023)
Apk Installer: Package Installer (default one on the phone)
Method building apk: flutter build apk or flutter build apk --build-name 1.1.0 --build-number 1

android/app/src/main/build.gradle:

defaultConfig {
applicationId "com.ceventures.app.locationalerts.cedric.eicher"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

Does anyone know how to solve this?

英文:

I have made an app in Flutter and am trying to install the apk on my physical device.I have done this numerous times in the past but recently I started getting this error when trying to install the apk:

--> "App not installed as package appears to be invalid."

Here are my specs, which hopefully will help:
Phone: Samsung S22+ (Android version 13, last updated Feb 2023)
Apk Installer: Package Installer (default one on the phone)
Method building apk: flutter build apk or flutter build apk --build-name 1.1.0 --build-number 1

android/app/src/main/build.gradle:

defaultConfig {
        applicationId "com.ceventures.app.locationalerts.cedric.eicher"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

Does anyone know how to solve this?

答案1

得分: 0

已解决:

对于将来遇到此问题的任何人,以下是最终对我起作用的内容。希望你也有同样的好运,因为这让我疯狂了好几周。

  1. 在这篇帖子的帮助下(https://stackoverflow.com/questions/54444538/how-do-i-run-test-my-flutter-app-on-a-real-device),我能够像在模拟器上一样直接部署到我的物理设备。为了使其工作,我必须执行:
  2. 这个(https://stackoverflow.com/questions/70333565/targeting-s-version-31-and-above-requires-that-an-explicit-value-for-android)。

在完成这些步骤后,我能够执行您典型的 flutter build apk 并像以前一样在我的设备上安装它。

希望这对你有帮助!

英文:

SOLVED:

For anyone coming across this in the future, here's what finally worked for me. I hope you have the same luck since this was driving me crazy for weeks.

  1. With the help of this post (https://stackoverflow.com/questions/54444538/how-do-i-run-test-my-flutter-app-on-a-real-device), I was able to deploy directly to my physical device just like I would my emulator. To make it work, I had to do:
  2. this (https://stackoverflow.com/questions/70333565/targeting-s-version-31-and-above-requires-that-an-explicit-value-for-android).

Following this, I was able to do your typical flutter build apk and install it on my device like before.

Hope this helps!!!

huangapple
  • 本文由 发表于 2023年5月22日 06:45:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302221.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定