Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在我的应用程序中设置“android.uid.system”后,它无法访问SD卡?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是一个奇怪的问题.如果我没有设置 android.uid.system,我的应用程序可以成功访问SD卡.但是在设置android.uid.system之后,我的应用程序无法访问sdcard.此时,异常发生:07-13 09:11:24.999:INFO / System.out(9986):创建文件发生异常—> java.io.IOException:权限被拒绝.我检查我在正确的地方写了正确的权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYstemS" />.

因为在我的应用程序中使用forceStopPackage,我需要将android.uid.system添加到清单中.我在make文件中写了LOCAL_CERTIFICATE:= platform.谁能解释这个奇怪的问题.设置android.uid.system后,我的应用程序属于系统进程,应该有更多的权限访问SD卡.这是我的想法.以下是我的代码

public void setPackage(String dir){

        System.out.println( "setPackage dir=="+dir  );
        File share=new File("/mnt/sdcard","test.txt");
        if(!share.exists()){
             try{
            share.createNewFile();

        }catch(Exception E){
            System.out.println( "creat file happen exception--->" +e.toString() );
        }
      }
         try{
           if(share!=null){
                System.out.println( "create file is not null"  );
                    FiLeoutputStream fops=new FiLeoutputStream(sharE);

                    fops.write(dir.getBytes());
                    fops.flush();
                    fops.close();
        }
        }catch(Exception E){
                System.out.println( "write Exception-->" +e.toString() );
        }

    }

我的应用程序在模拟器上运行,目标版本为2.3.非常感谢你.

解决方法

请阅读: link1

这个link2

大佬总结

以上是大佬教程为你收集整理的在我的应用程序中设置“android.uid.system”后,它无法访问SD卡?全部内容,希望文章能够帮你解决在我的应用程序中设置“android.uid.system”后,它无法访问SD卡?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。