记录一个 DELETE_FAILED_INTERNAL_ERROR Error while Installing APK问题
2017-10-26 10:10
621 查看
记录一个 DELETE_FAILED_INTERNAL_ERROR Error while Installing APK问题
之前遇到这个问题
将data/data/目录下该应用的包名的目录删除掉,如:adb shell rm -rf data/data/com.demo.helloworld/
然后重启下手机就好了
或者把Instant Run关掉就可以了
这里给两个连接 http://blog.csdn.net/ouyang_peng/article/details/50419276 https://stackoverflow.com/questions/38892270/delete-failed-internal-error-error-while-installing-apk
今天发现这个地方还有一种情况
都知道在7.0下共享文件需要使用FileProvider(参照了一下http://www.jianshu.com/p/3f9e3fc38eae)
1.在manifest中添加provider
2.资源文件下创建相应的xml文件(如上:则创建filepaths.xml)。
3 FileProvider
所以在使用FileProvider时,android:authorities 一定要唯一
之前遇到这个问题
将data/data/目录下该应用的包名的目录删除掉,如:adb shell rm -rf data/data/com.demo.helloworld/
然后重启下手机就好了
或者把Instant Run关掉就可以了
这里给两个连接 http://blog.csdn.net/ouyang_peng/article/details/50419276 https://stackoverflow.com/questions/38892270/delete-failed-internal-error-error-while-installing-apk
今天发现这个地方还有一种情况
都知道在7.0下共享文件需要使用FileProvider(参照了一下http://www.jianshu.com/p/3f9e3fc38eae)
1.在manifest中添加provider
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cn.lovexiaoai.myapp"> <application ...> <provider android:name="android.support.v4.content.FileProvider" android:authorities="cn.lovexiaoai.myapp.fileprovider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> ... </application> </manifest> //exported:要求必须为false,为true则会报安全异常。 //grantUriPermissions:true,表示授予 URI 临时访问权限。
2.资源文件下创建相应的xml文件(如上:则创建filepaths.xml)。
<paths> <external-path path="images" name="camera_photos" /> </paths>
3 FileProvider
File file = new File("/storage/emulated/0/Pictures/Screenshots/img_test.jpg"); //主要修改就在下面3行 /* getUriForFile(Context context, String authority, File file):此处的authority需要和manifest里面保持一致。 photoURI打印结果:content://cn.lovexiaoai.myapp.fileprovider/camera_photos/Pictures/Screenshots/testImg.png 。 这里的camera_photos:对应filepaths.xml中的name */ Uri photoURI = FileProvider.getUriForFile(context, "cn.lovexiaoai.myapp.fileprovider", file); /* 这句要记得写:这是申请权限,之前因为没有添加这个,打开裁剪页面时,一直提示“无法修改低于50*50像素的图片”, 开始还以为是图片的问题呢,结果发现是因为没有添加FLAG_GRANT_READ_URI_PERMISSION。 如果关联了源码,点开FileProvider的getUriForFile()看看(下面有),注释就写着需要添加权限。 */ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setDataAndType(photoURI, "image/*"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("outputX", 80); intent.putExtra("outputY", 80); intent.putExtra("return-data", false); context.startActivityForResult(intent, 1);
重点在这里
<provider android:name="android.support.v4.content.FileProvider" android:authorities="cn.lovexiaoai.myapp.fileprovider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider>
android:authorities="cn.lovexiaoai.myapp.fileprovider"如果有两个APP的authorities是一样的
也会报错记录一个 DELETE_FAILED_INTERNAL_ERROR Error while Installing APK问题
所以在使用FileProvider时,android:authorities 一定要唯一
相关文章推荐
- 解决关于 在android studio 出现的 DELETE_FAILED_INTERNAL_ERROR Error while Installing APK 问题
- 解决关于 在android studio 出现的 DELETE_FAILED_INTERNAL_ERROR Error while Installing APK 问题
- 关于DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs的一些问题
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs 解决:File->Settings->Build,Execuion,Deploymen
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs问题解决
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
- 解决Ubuntu 16.04 上Android Studio2.3上面运行APP时提示DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs的问题
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- Android studio DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- Android安装APK出现DELETE_FAILED_INTERNAL_ERROR,Error while Installing APKs
- 小米手机调试出现DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- Android studio DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- 【Android】DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs