问题
I'm developing a Xamarin.Forms App (early stages) and have just set up AppCenter to build and distribute it. AppCenter takes the Xamarin.Android project, builds it successfully, signs with the same debug keys and makes the .apk available for download. I've tested in two different devices and the app installs successfully but won't run (opens and closes straightaway), no errors are shown.
If I deploy the app from Visual Studio it works fine.
- Xamarin.Forms 3.4.0.1008975
- Mono.Android v4.0.30319 (Xamarin.Android)
- Minimum Android 4.4 / Target 8.1
- Tested on Android 6 and 9 (both work if deployed from Visual Studio, and don't work with the distributed release from AppCenter)
Logcat:
Time Device Name Type PID Tag Message
03-16 18:13:55.483 Sony D6503 Warning 1326 WindowManager java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@8108048 does not exist
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8890)
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8881)
at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2766)
at com.android.server.wm.Session.remove(Session.java:187)
at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3103)
at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5610)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3413)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
03-16 18:13:55.483 Sony D6503 Warning 1326 WindowManager Failed looking up window
03-16 18:13:55.474 Sony D6503 Warning 1326 ActivityManager Force removing ActivityRecord{6a47b30 u0 com.companyname/md5dac3b7b583c4c7d6c1c265db80217d7a.MainActivity t28}: app died, no saved state
03-16 18:13:55.424 Sony D6503 Error 27642 monodroid No assemblies found in '/data/user/0/com.companyname/files/.__override__' or '/storage/emulated/0/Android/data/com.companyname/files/.__override__'. Assuming this is part of Fast Deployment. Exiting...
Any suggestion is strongly appreciated.
回答1:
The solution to this problem was to disable the "Use Shared Runtime" property from the project options.
Instructions:
- Right click on the android project
- Go to Android Options
- Uncheck "Use Shared Runtime"
- Commit && push the changes
- Trigger a new build on AppCenter
来源:https://stackoverflow.com/questions/55195365/appcenter-xamarin-android-builds-and-installs-successfully-on-devices-but-doesn