简体   繁体   English

Xamarin Android保存文件,Environment.Specialfolder不存在

[英]Xamarin Android save files, Environment.Specialfolder does not exist

I just created an Xamarin Android Single-View-app, which downloads a file from dropbox. 我刚刚创建了一个Xamarin Android Single-View-app,它可以从保管箱下载文件。 I earlier made this app, but my Mac's HDD crashed. 我早些时候做了这个应用程序,但是我的Mac的HDD崩溃了。 I searched for the save-location and found: 我搜索了保存位置并发现:

var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var filename = Path.Combine(path, "newFile.png");

I tried it, but it was marked red, because it does not exist. 我尝试过,但是它被标记为红色,因为它不存在。 I installed Xamarin yesterday, I have the latest version. 我昨天安装了Xamarin,我拥有最新版本。 I searched for hours, but i did not find a solution of the problem. 我搜索了几个小时,但没有找到解决问题的方法。 Here are my "using's": 这是我的“使用”:

using Android.App;
using Android.Widget;
using Android.OS;
using System.IO;
using System.Net;
using System;
using System.ComponentModel;

Try explicitly specifying the namespace, System.Environment.GetFolderPath() and System.Environment.SpecialFolder.ApplicationData. 尝试显式指定名称空间System.Environment.GetFolderPath()和System.Environment.SpecialFolder.ApplicationData。 You may have a conflict between two different namespaces that both use "Environment" 您可能会在两个都使用“环境”的不同名称空间之间发生冲突

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin.Forms.Android:在编译/部署时使用示例数据文件填充“Environment.SpecialFolder.Personal” - Xamarin.Forms.Android: Populating 'Environment.SpecialFolder.Personal' with sample data files at compilation/deployment Windows中Xamarin.Android的System.Environment.SpecialFolder.MyDocuments的文件夹路径 - Folder path of System.Environment.SpecialFolder.MyDocuments of Xamarin.Android in windows Xamarin-Android Drawable存在吗? - Xamarin - Does Android Drawable Exist? 在Xamarin Android名称中绑定.AAR不存在 - Binding an .AAR in Xamarin Android name does not exist Android如何保存文件? - How does android save files? Xamarin Android SDK adb.exe不存在 - Xamarin Android SDK adb.exe does not exist Xamarin错误:Android上的System.Security.Cryptography中不存在Pkcs - Xamarin error: Pkcs does not exist in System.Security.Cryptography on Android Xamarin Android保存短信 - Xamarin Android Save sms Xamarin.Forms.Platform.Android.FormsApplicationActivity Xamarin.Forms中不存在平台命名空间的类型 - Xamarin.Forms.Platform.Android.FormsApplicationActivity The type of namespace Platform does not exist in Xamarin.Forms Xamarin 从 2.5 更新到 3.5 后 Xamarin.Forms.Platform.Android 不存在 - Xamarin.Forms.Platform.Android does not exist after Xamarin update from 2.5 to 3.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM