草庐IT

fileNotFoundException

全部标签

安卓:getAssets().openFd() 和 FileNotFoundException

我正在尝试从assets文件夹中读取一个txt文件:descriptor=context.getAssets().openFd("openAccess.txt");reader=newFileReader(descriptor.getFileDescriptor());但我遇到了这个异常:java.io.FileNotFoundException:Thisfilecannotbeopenedasafiledescriptor;itisprobablycompressed不知道是什么问题? 最佳答案 这个怎么样:InputStream

java.io.FileNotFoundException :/storage/emulated/0/错误

我正在尝试通过我在androidstudio中的应用创建一个.txt文件。SDK版本10,我的模拟器是galaxyS7(我不确定这是否重要)。我写了下面的类,它一直给我文件无异常错误。我在谷歌上搜索了很多并搜索了这个论坛,但没有一个有效。请帮忙。我的类(class)..publicstaticvoidStoreData(Stringinput)throwsIOException{FileRoot=Environment.getExternalStorageDirectory();Log.d("hello",Root.getAbsolutePath());FileDir=newFile(

android - Android Studio 核心中的 FileNotFoundException 异常?

我刚刚安装了AndroidStudio2.3.3并创建了一个新项目。然后错误发生了。这是事件日志2017/7/3021:50FileNotFoundException:EntryfileTemplates//code/GoogleTestFixtureSetUpMethod.cc.ftnotfoundinC:/ProgramFiles/Android/AndroidStudio/lib/idea.jar21:50Gradlesyncstarted21:50InvalidVirtualFileAccessException:Accessinginvalidvirtualfile:file

java - 在文件名中使用空格在 Android 中保存文件

我的android应用程序需要将一个xml文件保存到外部缓存中,文件名中包含空格。DOMSourcesource=newDOMSource(doc);StreamResultresult=newStreamResult(newFile(activity.getExternalCacheDir().getAbsolutePath()+"/Localstorage.xml"));transformer.transform(source,result);当我手动浏览到我的文件目录时,我找到了这个文件:“Local%20storage.xml”。所以当我尝试用阅读它之后FilelocalSto

android - BitmapFactory:无法解码流:java.io.FileNotFoundException

我有一个关于BitMapFactory.decodeFile的问题。在我的应用中,我希望用户能够从他/她的设备中选择图像或拍照。然后必须将其显示在ImageView中这是代码fragment:UriselectedImage=data.getData();String[]filePathColumn={MediaStore.Images.Media.DATA};Cursorcursor=getContentResolver().query(selectedImage,filePathColumn,null,null,null);cursor.moveToFirst();intcolum

【已解决】在linux部署出现java文件操作报错:java.io.FileNotFoundException

1.报错场景:其中的ip2region.xdb文件是放在 resources文件夹中的,然后在一个工具类里面读取这个文件,在开发环境中的是这样读取的: ClassPathResourceresource=newClassPathResource("ip2region.xdb");//获取真实文件路径Stringpath=resource.getURL().getPath();byte[]cBuff=Searcher.loadContentFromFile(path);然后部署到linux上后,就出现了错误,报java.io.FileNotFoundException 2.解决方法:ClassP

Android - 资源$NotFoundException

我有一个拥有超过100.000名用户的应用程序。但是在某些设备(~50)上我得到了一个奇怪的异常。堆栈跟踪显示,未找到可绘制对象。这是堆栈跟踪:java.lang.RuntimeException:UnabletostartactivityComponentInfo{mindmApp.the.big.bang.theory.quiz/mindmApp.the.big.bang.theory.quiz.GameNormalActivity}:android.view.InflateException:BinaryXMLfileline#237:Errorinflatingclass...

使用 RandomAccessFile 创建文件时出现 java.io.FileNotFoundException

当我尝试使用RandomAccessFile创建文件时遇到FileNotFoundException:RandomAccessFilefile=newRandomAccessFile("/test.jpg","rw");我现在不知道如何解决这个问题。这让我发疯。谢谢 最佳答案 尝试RandomAccessFilefile=newRandomAccessFile(newFile(getFilesDir(),"test.jpg"),"rw"); 关于使用RandomAccessFile创建文

android - 无法将调试器用于 xamarin android 项目 : System. IO.FileNotFoundException : Could not load file or assembly Mono. Posix

将我的visualstudio2017升级到15.2v(26430.12)Xamarin.AndroidSDK7.3.1.2(9dbc4c5)不能再使用调试器了。项目构建成功并部署完成,但随后发生此错误:CouldnotloadfileorassemblyMono.Posix完整错误信息: 最佳答案 这是一个KnownIssue.根本原因是C:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Enterprise\Common7\IDE\Extensions\Xamarin.VisualSt

java - 解压缩时 FileOutputStream 抛出 FileNotFoundException

我正在使用通过谷歌找到的类来解压缩.zip文件。.zip包含文件和文件夹。问题是FileOutputStreamthrowsFileNotFoundException..但是文件应该从.zip文件中获取,所以它以前怎么可能存在?这是我在AsyncTask中使用的代码:@OverrideprotectedBooleandoInBackground(String...params){try{StringzipFile=Path+FileName;FileInputStreamfin=newFileInputStream(zipFile);ZipInputStreamzin=newZipIn