xamarin.forms:在我的Android应用程序上,当我点击主页按钮或后退按钮或尝试使用Plugin.Media拍照。
我在我的项目JamesMontemagno , Xamarin.Plugins中使用。
我得到了
以下错误:
UNHANDLED EXCEPTION:
System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Sharing violation on path PropertyStore.forms
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0026d] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO/FileStream.cs:249
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO/FileStream.cs:149
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs:127
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile isf) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs:142
at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFileStream:.ctor (string,System.IO.FileMode,System.IO.IsolatedStorage.IsolatedStorageFile)
at System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile (System.String path, System.IO.FileMode mode) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs:908
at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFile:OpenFile (string,System.IO.FileMode)
at Xamarin.Forms.Platform.Android.Deserializer+<>c.b__1_0 () [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Deserializer.cs:22
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x00012] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680
at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
这是我的AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="MY_PACKAGE_NAME" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="MyApp" android:icon="@drawable/icon" android:largeHeap="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="MY_GOOGLE_API_KEY" />
<provider android:name="android.support.v4.content.FileProvider" android:authorities="MY_PACKAGE_NAME.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
</manifest>
引起我上面写的异常的情景:
1.在我的android / emulator中启动应用程序
2.启动画面完成加载,然后转移到我的登录页面
3.当我登录登录页面时,单击主页按钮或后退按钮
我得到了上面提到的例外情况。
根据这个callstack,我无法解释错误的起源是什么, 但如果有人有相同的例外并找到解决方案,我会很高兴听到解决方案。