【问题标题】:Flutter app runs with 'flutter run' but fails when installing apk on the same deviceFlutter 应用程序以“flutter run”运行,但在同一设备上安装 apk 时失败
【发布时间】:2020-09-30 12:48:58
【问题描述】:

我有一个颤动的应用程序,它产生了一个非常奇怪的行为; 当我在设备上运行它时,它运行完美,但是,当我构建一个 apk 并将其安装在同一设备上时,我在启动屏幕后得到一个空白应用程序。

我的“flutter run --verbose”会产生以下结果:

adb: failed to install /Volumes/<my volume>/<app name>/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.<app name> signatures do
                     not match the previously installed version; ignoring!]
[        ] Installing build/app/outputs/apk/app.apk... (completed in 23.4s)
[   +1 ms] Error: ADB exited with exit code 1
[   +2 ms] Performing Streamed Install

           adb: failed to install /Volumes/<my volume>/<app name>/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.<app name> signatures do not match
the
           previously installed version; ignoring!]
[        ] Warning: Failed to install APK.
[        ] Uninstalling old version...
[   +1 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb version
[   +7 ms] Android Debug Bridge version 1.0.41
           Version 30.0.1-6435776
           Installed as /Users/Fedo/Library/Android/sdk/platform-tools/adb
[        ] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb start-server
[   +7 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb -s 521075515175442b uninstall com.<app name>
[ +898 ms] Success
[   +1 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb version
[   +8 ms] Android Debug Bridge version 1.0.41
           Version 30.0.1-6435776
           Installed as /Users/Fedo/Library/Android/sdk/platform-tools/adb
[        ] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb start-server
[   +7 ms] Installing build/app/outputs/apk/app.apk...
[        ] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb -s 521075515175442b install -t -r /Volumes/<my volume>/<app name>/build/app/outputs/apk/app.apk
[+21374 ms] Performing Streamed Install
                     Success
[        ] Installing build/app/outputs/apk/app.apk... (completed in 21.4s)
[   +1 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb -s 521075515175442b shell echo -n f160fe28fb3823dca786631864904b6d62c39b80 >
/data/local/tmp/sky.com.<app name>.sha1
[  +32 ms] SM A520F startApp
[   +4 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb -s 521075515175442b shell am start -a android.intent.action.RUN -f 0x20000000 --ez
enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true com.<app name>/com.<app name>.MainActivity
[ +269 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.<app name>/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...
[+1800 ms] W/FlutterActivity(10085): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7347068) but could not find and invoke the
GeneratedPluginRegistrant.
[ +447 ms] Observatory URL on device: http://127.0.0.1:41406/t9RAZ1SuTsU=/
[   +2 ms] executing: /Users/Fedo/Library/Android/sdk/platform-tools/adb -s 521075515175442b forward tcp:0 tcp:41406
[  +18 ms] 55539
[        ] Forwarded host port 55539 to device port 41406 for Observatory
[  +15 ms] Connecting to service protocol: http://127.0.0.1:55539/t9RAZ1SuTsU=/
[ +577 ms] Successfully connected to service protocol: http://127.0.0.1:55539/t9RAZ1SuTsU=/
[   +3 ms] Sending to VM service: getVM({})
[   +6 ms] Result: {type: VM, name: vm, architectureBits: 64, hostCPU: Unknown, operatingSystem: android, targetCPU: arm64, version: 2.8.4 (stable) (Wed Jun 3 12:26:04 2020 +0200)
on "android_arm64", _profilerMode: VM, _nativeZoneMemoryUsage: 0, pid: 10085, startTim...
[   +6 ms] Sending to VM service: getIsolate({isolateId: isolates/118799356522035})
[   +3 ms] Sending to VM service: _flutter.listViews({})
[  +10 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0x71d2641720, isolate: {type: @Isolate, fixedId: true, id: isolates/118799356522035, name:
main.dart$main-118799356522035, number: 118799356522035}}]}
[  +10 ms] DevFS: Creating new filesystem on the device (null)
[   +1 ms] Sending to VM service: _createDevFS({fsName: <app name>})
[  +71 ms] Result: {type: FileSystem, name: <app name>, uri: file:///data/user/0/com.<app name>/code_cache/<app name>EZOAKW/<app name>/}
[        ] DevFS: Created new filesystem on the device (file:///data/user/0/com.<app name>/code_cache/<app name>EZOAKW/<app name>/)
[   +2 ms] Updating assets
[ +392 ms] Syncing files to device SM A520F...
[   +1 ms] Scanning asset files
[   +8 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +2 ms] <- recompile package:<app name>/main.dart c169bab3-dd7d-4f83-a2ba-a10ff3fe3fb2
[        ] <- c169bab3-dd7d-4f83-a2ba-a10ff3fe3fb2
[   +3 ms] D/SurfaceView(10085): surfaceChanged (1080,1920) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{198c398 V.E...... ......ID 0,0-1080,1920}
[        ] D/ViewRootImpl@481c8ac[MainActivity](10085): MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 1920) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
[        ] D/ViewRootImpl@481c8ac[MainActivity](10085): MSG_WINDOW_FOCUS_CHANGED 1
[        ] V/InputMethodManager(10085): Starting input: tba=android.view.inputmethod.EditorInfo@933c7f1 nm : com.<app name> ic=null
[        ] I/InputMethodManager(10085): startInputInner - mService.startInputOrWindowGainedFocus
[        ] D/ViewRootImpl@481c8ac[MainActivity](10085): Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x3 surface={valid=true 489091063808} changed=false
[        ] V/InputMethodManager(10085): Starting input: tba=android.view.inputmethod.EditorInfo@75dbfd6 nm : com.<app name> ic=null
[  +29 ms] Result: {type: Isolate, id: isolates/118799356522035, name: main, number: 118799356522035, _originNumber: 118799356522035, startTime: 1591830107303, _heaps: {new: {type:
HeapSpace, name: new, vmName: Scavenger, collections: 0, avgCollectionPeriodMillis: 0...
[ +173 ms] D/libGLESv2(10085): STS_GLApi : DTS, ODTC are not allowed for Package : com.<app name>
[ +393 ms] Updating files
[  +29 ms] I/flutter (10085): {app_name: <app name>, default_tax: null, default_currency: null, currency_right: false, enable_paypal: true, enable_stripe: true, mobile_language: en}
[ +950 ms] DevFS: Sync finished
[   +2 ms] Syncing files to device SM A520F... (completed in 1,596ms)
[        ] Synced 6.1MB.
[   +1 ms] Sending to VM service: _flutter.listViews({})
[   +6 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0x71d2641720, isolate: {type: @Isolate, fixedId: true, id: isolates/118799356522035, name:
main.dart$main-118799356522035, number: 118799356522035}}]}
[   +1 ms] <- accept
[        ] Connected to _flutterView/0x71d2641720.
[   +2 ms] Flutter run key commands.
[   +2 ms] r Hot reload. ????????????
[   +1 ms] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] An Observatory debugger and profiler on SM A520F is available at: http://127.0.0.1:55539/t9RAZ1SuTsU=/
[+1773 ms] E/flutter (10085): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel
plugins.flutter.io/shared_preferences)
[        ] E/flutter (10085): 
[+1828 ms] I/zygote64(10085): Do partial code cache collection, code=27KB, data=28KB
[        ] I/zygote64(10085): After code cache collection, code=27KB, data=28KB
[        ] I/zygote64(10085): Increasing code cache capacity to 128KB
[+1194 ms] I/flutter (10085): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
[        ] I/flutter (10085): The following assertion was thrown while applying parent data.:
[        ] I/flutter (10085): Incorrect use of ParentDataWidget.
[        ] I/flutter (10085): The ParentDataWidget Positioned wants to apply ParentData of type StackParentData to a RenderObject,
[        ] I/flutter (10085): which has been set up to accept ParentData of incompatible type FlexParentData.
[        ] I/flutter (10085): Usually, this means that the Positioned widget has the wrong ancestor RenderObjectWidget. Typically,
[        ] I/flutter (10085): Positioned widgets are placed directly inside Stack widgets.
[        ] I/flutter (10085): The offending Positioned is currently placed inside a Column widget.
[        ] I/flutter (10085): The ownership chain for the RenderObject that received the incompatible parent data was:
[        ] I/flutter (10085):   ConstrainedBox ← Container ← Positioned ← Column ← _SingleChildViewport ←
[        ] I/flutter (10085): IgnorePointer-[GlobalKey#37f81] ← Semantics ← _PointerListener ← Listener ← _GestureSemantics ← ⋯
[        ] I/flutter (10085): 
[        ] I/flutter (10085): When the exception was thrown, this was the stack:
[        ] I/flutter (10085): #0      RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:5645:11)
[        ] I/flutter (10085): #1      RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:5661:6)
[        ] I/flutter (10085): #2      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:5682:7)
[        ] I/flutter (10085): #3      RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5376:5)
[        ] I/flutter (10085): #4      SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5829:11)
[        ] I/flutter (10085): ...     Normal element mounting (13 frames)
[        ] I/flutter (10085): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
[        ] I/flutter (10085): #18     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
[        ] I/flutter (10085): ...     Normal element mounting (109 frames)
[        ] I/flutter (10085): #127    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
[        ] I/flutter (10085): #128    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
[        ] I/flutter (10085): ...     Normal element mounting (193 frames)
[        ] I/flutter (10085): #321    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
[        ] I/flutter (10085): #322    Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
[        ] I/flutter (10085): #323    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5580:32)
[        ] I/flutter (10085): #324    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5957:17)
[        ] I/flutter (10085): #325    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #326    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (10085): #327    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (10085): #328    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (10085): #329    StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5)
[        ] I/flutter (10085): #330    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #331    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (10085): #332    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (10085): #333    ProxyElement.update (package:flutter/src/widgets/framework.dart:4862:5)
[        ] I/flutter (10085): #334    _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:181:11)
[        ] I/flutter (10085): #335    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #336    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (10085): #337    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #338    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (10085): #339    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (10085): #340    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (10085): #341    StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5)
[        ] I/flutter (10085): #342    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #343    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (10085): #344    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #345    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (10085): #346    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #347    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (10085): #348    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (10085): #349    StatelessElement.update (package:flutter/src/widgets/framework.dart:4583:5)
[        ] I/flutter (10085): #350    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (10085): #351    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (10085): #352    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (10085): #353    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (10085): #354    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2627:33)
[        ] I/flutter (10085): #355    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:20)
[        ] I/flutter (10085): #356    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
[        ] I/flutter (10085): #357    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
[        ] I/flutter (10085): #358    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
[        ] I/flutter (10085): #359    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
[        ] I/flutter (10085): #363    _invoke (dart:ui/hooks.dart:261:10)
[        ] I/flutter (10085): #364    _drawFrame (dart:ui/hooks.dart:219:3)
[        ] I/flutter (10085): (elided 3 frames from dart:async)
[        ] I/flutter (10085): ════════════════════════════════════════════════════════════════════════════════════════════════════
[ +139 ms] I/flutter (10085): Another exception was thrown: Incorrect use of ParentDataWidget.

问题: 当我在设备上“颤振运行”应用程序时,它可以完美运行并产生以前的问题......但是当我在同一设备上使用“颤振构建 apk”然后“颤振安装”时,我的应用程序是一个空白屏幕

... Flutter Doctor 没有产生任何问题,我还安装了最新版本的 Flutter。

非常感谢您在这个问题上的帮助,因为我对 Flutter 比较陌生,而且我无法从上一个堆栈中找出错误。

非常感谢。

【问题讨论】:

  • 您好,您是否尝试手动卸载该应用程序?如果您在设备上有多个用户或访客用户帐户,请尝试登录该帐户并手动卸载它
  • @thusith.92 我确实卸载并重新安装了几次应用程序,但无济于事

标签: flutter mobile


【解决方案1】:

尝试卸载该应用。当您在设备上手动安装 APK,然后尝试通过命令行安装应用时,可能会发生这种情况。

【讨论】:

  • 我确实卸载并重新安装了该应用程序几次,但无济于事。是的,我只在使用 Flutter 开发时使用命令行。
猜你喜欢
  • 2020-11-15
  • 2019-10-21
  • 2023-04-08
  • 1970-01-01
  • 2019-09-26
  • 1970-01-01
  • 1970-01-01
  • 2022-11-30
  • 1970-01-01
相关资源
最近更新 更多