仅在Moto G5 Plus中:java.io.FileNotFoundException

时间:2017-04-13 14:22:19

标签: java android

我在这段代码中需要帮助,问题只发生在Moto G5 Plus上。 当我在其他手机上运行时,它运行得很好。

        try {
        FileInputStream fis;
        String caminho = arqUri.getPath();

        File file = new File(caminho);
        fis = new FileInputStream(file);

        skR1.setProgress((byte)fis.read());
        skR2.setProgress((byte)fis.read());
        skR3.setProgress((byte)fis.read());
        skR4.setProgress((byte)fis.read());

        fis.close();

    } catch (FileNotFoundException e) {
        Log.d("Artur", "Erro: "+e.toString());
        Toast.makeText(getApplicationContext(),"Arquivo não encontrado!", Toast.LENGTH_SHORT).show();
        e.printStackTrace();

    } catch (IOException e) {
        Toast.makeText(getApplicationContext(),"Não foi possível abrir o arquivo!", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }

logcat:

  

04-17 10:10:3​​9.840 9775-9775 /?我/艺术:延迟启用-Xcheck:jni   04-17 10:10:40.071 9775-9775 / com.redline_efi.redlinewifiBeta I / InstantRun:启动即时运行服务器:是主进程   04-17 10:10:40.137 9775-9775 / com.redline_efi.redlinewifiBeta W / art:在Android 4.1之前,方法android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,android .content.res.ColorStateList,android.graphics.PorterDuff $ Mode)会错误地覆盖android.graphics.drawable.Drawable中的package-private方法   10月4日至17日:10:40.312 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err的:java.io.FileNotFoundException:/媒体/电报/电报文档/ 1_5147931815117324292.rlc(没有这样的文件或目录)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at java.io.FileInputStream.open(Native Method)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at java.io.FileInputStream。(FileInputStream.java:146)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at com.redline_efi.redlinewifi.MainActivity.onCreate(MainActivity.java:172)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.Activity.performCreate(Activity.java:6672)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.ActivityThread.-wrap12(ActivityThread.java)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1473)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.os.Handler.dispatchMessage(Handler.java:102)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.os.Looper.loop(Looper.java:154)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at android.app.ActivityThread.main(ActivityThread.java:6123)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at java.lang.reflect.Method.invoke(Native Method)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:867)   04-17 10:10:40.317 9775-9775 / com.redline_efi.redlinewifiBeta W / System.err:at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

0 个答案:

没有答案