Flutter apk已安装但无法找到/打开

K B*_*K B 4 android apk flutter

我花了几周的时间试图解决这个问题,但我无法让它发挥作用。

\n

语境:

\n

颤振运行

\n
    \n
  • 我可以执行“flutter run”,它将在我的手机上启动该应用程序。
  • \n
  • 关闭应用程序后,我在应用程序页面中看不到它。我无法搜索它。
  • \n
  • “访问”应用程序的唯一方法是转到设置 -> 应用程序。在这里我无法打开该应用程序,唯一的选择就是卸载它。
  • \n
\n

颤振构建

\n
    \n
  • 我可以构建一个应用程序。“flutter build apk”工作正常。
  • \n
  • 如果安装了应用程序的早期版本,则无法安装 apk。
  • \n
  • 如果我从设置 -> 应用程序卸载以前的应用程序,我可以安装新的 apk。但我无法打开它。它只说“完成”,“打开”呈灰色。
  • \n
\n

我尝试过的:

\n
    \n
  • 从设置 -> 应用程序卸载应用程序
  • \n
  • 扑干净
  • \n
  • 从 build.gradle 中删除了签名
  • \n
  • 将歌唱版本更改为调试
  • \n
  • flutter 构建 apk -split-per-api
  • \n
  • 本指南https://flutteragency.com/how-to-fix-release-apk-is-not-working-properly/
  • \n
  • “为所有用户”卸载
  • \n
  • 运行“adb shell am start com.example/.mainActivity”-> 有效
  • \n
  • “adb shell pm list packages” 显示我的包 ID
  • \n
\n

附加信息\n我不知道这是否重要,但我最近添加了签名配置并向应用程序商店发布了一个应用程序包。appbundle 和 apk 文件冲突可能会出现问题吗?

\n

我的“扑医生-v”

\n
[\xe2\x9c\x93] Flutter (Channel stable, 2.10.4, on macOS 12.1 21C52 darwin-arm, locale sv-SE)\n    \xe2\x80\xa2 Flutter version 2.10.4 at /Users/*/dev/flutter\n    \xe2\x80\xa2 Upstream repository https://github.com/flutter/flutter.git\n    \xe2\x80\xa2 Framework revision c860cba910 (4 weeks ago), 2022-03-25 00:23:12 -0500\n    \xe2\x80\xa2 Engine revision 57d3bac3dd\n    \xe2\x80\xa2 Dart version 2.16.2\n    \xe2\x80\xa2 DevTools version 2.9.2\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)\n    \xe2\x80\xa2 Android SDK at /Users/*/Library/Android/sdk/\n    \xe2\x80\xa2 Platform android-32, build-tools 32.1.0-rc1\n    \xe2\x80\xa2 ANDROID_HOME = /Users/*/Android/Sdk\n    \xe2\x80\xa2 Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)\n    \xe2\x80\xa2 All Android licenses accepted.\n\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 13.2.1)\n    \xe2\x80\xa2 Xcode at /Applications/Xcode.app/Contents/Developer\n    \xe2\x80\xa2 CocoaPods version 1.11.2\n\n[\xe2\x9c\x93] Chrome - develop for the web\n    \xe2\x80\xa2 Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n\n[\xe2\x9c\x93] Android Studio (version 2021.1)\n    \xe2\x80\xa2 Android Studio at /Applications/Android Studio.app/Contents\n    \xe2\x80\xa2 Flutter plugin can be installed from:\n       https://plugins.jetbrains.com/plugin/9212-flutter\n    \xe2\x80\xa2 Dart plugin can be installed from:\n       https://plugins.jetbrains.com/plugin/6351-dart\n    \xe2\x80\xa2 Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)\n\n[\xe2\x9c\x93] VS Code (version 1.64.2)\n    \xe2\x80\xa2 VS Code at /Applications/Visual Studio Code.app/Contents\n    \xe2\x80\xa2 Flutter extension version 3.38.1\n\n[\xe2\x9c\x93] Connected device (1 available)\n    \xe2\x80\xa2 Chrome (web) \xe2\x80\xa2 chrome \xe2\x80\xa2 web-javascript \xe2\x80\xa2 Google Chrome 100.0.4896.122\n\n[\xe2\x9c\x93] HTTP Host Availability\n    \xe2\x80\xa2 All required HTTP hosts are available\n\n\xe2\x80\xa2 No issues found!\n
Run Code Online (Sandbox Code Playgroud)\n

\xc2\xb4\xc2\xb4\xc2\xb4

\n

K B*_*K B 17

我解决了

问题是我的意图。

他们怎么样:

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    <action android:name="android.intent.action.VIEW" />          
    <category android:name="android.intent.category.DEFAULT" />        
    <category android:name="android.intent.category.BROWSABLE" /> 
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

他们应该如何:

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.VIEW" />            
    <category android:name="android.intent.category.DEFAULT" />        
    <category android:name="android.intent.category.BROWSABLE" /> 
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

  • 没办法!我不敢相信这竟然有效!我尝试了所有其他解决方案 - 这就是我需要的解决方案。谢谢@KB (2认同)