简体   繁体   English

RecoverySystem.installPackage - / cache / recovery / command:open failed:EACCESS(权限被拒绝) - 将Android更新到4.3+后缺少权限

[英]RecoverySystem.installPackage - /cache/recovery/command: open failed: EACCESS (permission denied) - missing permission after update Android to 4.3+

I already searched in the Internet an answer to my problem, but unfortunately I have not found a solution for my issue. 我已经在互联网上搜索了我的问题的答案,但不幸的是我没有找到解决我的问题的方法。 I even wrote in this case on the official forum , Unfortunately, the moderators could not cope with this problem. 我甚至在官方论坛上写过这个案例,不幸的是,主持人无法应对这个问题。 Below I describe the problem, hoping that someone had a similar problem and knows the solution. 下面我描述问题,希望有人有类似的问题,并知道解决方案。

I made an application that works fine on Android 4.1, which is why I reject the problems associated with the lack of "something". 我创建了一个在Android 4.1上运行良好的应用程序,这就是为什么我拒绝与缺少“某些东西”相关的问题。 For now, it seems that in newer versions of android is a bug, because after updating to Android 4.3+ (API 18+) my app shows the message: 现在,似乎在较新版本的android中是一个bug,因为在更新到Android 4.3+(API 18+)后,我的应用程序会显示以下消息:

/cache/recovery/command: open failed: EACCESS (permission denied) / cache / recovery / command:open failed:EACCESS(权限被拒绝)

My application is an system application, so the file *.apk was put in directory /system/app/ together with a suitable file access permissions (chmod), so that the context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM is equal 1. 我的应用程序是一个系统应用程序,因此文件*.apk与适当的文件访问权限(chmod)一起放在目录/system/app/ ,以便context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM等于1 。

Because the application uses the method RecoverySystem.installPackage(...) I added permissions: 因为应用程序使用方法RecoverySystem.installPackage(...)我添加了权限:

<uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" /> <uses-permission android:name="android.permission.REBOOT" /> <uses-permission android:name="android.permission.DELETE_CACHE_FILES" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

More than the required minimum, because among others my application uses the method RecoverySystem.verifyPackage(...) Also, this method had problems after updating to Android 4.3+, but these problems have been solved after adding one of (or all) permissions: 超过所需的最小值,因为其中我的应用程序使用方法RecoverySystem.verifyPackage(...)此外,此方法在更新到Android 4.3+后出现问题,但这些问题在添加其中一个(或所有)权限后已得到解决:

<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

NOTE: For testing I added to manifest file also all the possible permissions that are available, but this does not solve the problem. 注意:对于测试,我还在清单文件中添加了所有可用的权限,但这并没有解决问题。

Once again, I would like to emphasize that the application works correctly until an update to android 4.3+. 再一次,我想强调应用程序正常工作,直到更新到android 4.3+。 After the update there is an error with the message: 更新后,消息出错:

/cache/recovery/command: open failed: EACCESS (permission denied) / cache / recovery / command:open failed:EACCESS(权限被拒绝)

This error occurs when call the method RecoverySystem.installPackage(...) . 调用方法RecoverySystem.installPackage(...)时会发生此错误。 ( FileWriter command = new FileWriter(COMMAND_FILE); where COMMAND_FILE == /cache/recovery/command ) FileWriter command = new FileWriter(COMMAND_FILE);其中COMMAND_FILE == /cache/recovery/command

I'm not sure, but I think that one of the possible reasons may be bug in the 'bootable/recovery/recovery.c', but I can not find any confirmation. 我不确定,但我认为其中一个可能的原因可能是'bootable / recovery / recovery.c'中的错误,但我找不到任何确认。

If anyone can help, I'd be grateful. 如果有人可以提供帮助,我将不胜感激。

PS To avoid mess in the Internet, do not post with texts like "use Google", "already it was - I've seen it somewhere - but can not remember where", "I have the same problem / also not working for me", and other posts which do not help solve the problem. PS为了避免互联网上的混乱,不要发布像“使用谷歌”这样的文字,“已经是 - 我已经在某个地方看到了 - 但不记得在哪里”,“我有同样的问题/也不适合我“,以及其他无法解决问题的帖子。


@shiri-hrw Thanks for reply. @ shiri-hrw感谢您的回复。

after adding android:sharedUserId="com.google.uid.shared" to my apps manifest (AndroidManifest.xml), an error occurred: android:sharedUserId =“com.google.uid.shared”添加到我的应用清单(AndroidManifest.xml)后,发生错误:

Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE Please check logcat output for more details. 安装错误:INSTALL_FAILED_SHARED_USER_INCOMPATIBLE请检查logcat输出以获取更多详细信息。 Launch canceled! 发布取消了!

LogCat logcat的

Package com.example.test has no signatures that match those in shared user com.google.uid.shared ; 包com.example.test没有与共享用户com.google.uid.shared中的签名相匹配的签名; ignoring! 无视!

and/or 和/或

Package com.example.test has no signatures that match those in shared user android.uid.system ; 包com.example.test没有与共享用户android.uid.system中的签名匹配的签名; ignoring! 无视!

You wrote: 你写了:

...as your app isn't signed with google signatures... ...因为您的应用未使用Google签名进行签名...

but after sign application, using files *.pk8 and *.x509.pem, which can be found under build/target/product/security in the pulbic sdk. 但是在签名申请之后,使用文件* .pk8和* .x509.pem,可以在pulbic sdk中的build / target / product / security下找到。

java -jar SignApk.jar platform.x509.pem platform.pk8 Application.apk Application_signed.apk

and/or 和/或

java -jar SignApk.jar shared.x509.pem shared.pk8 Application.apk Application_signed.apk

the error still occurs. 错误仍然发生。

When I push my app to system/app (and reboot) the application is not visible in apps. 当我将我的应用程序推送到系统/应用程序 (并重新启动)时,应用程序在应用程序中不可见。

I was having same problem, but solved it. 我有同样的问题,但解决了它。 If you firmware is 4.3+ then, You should add android:sharedUserId="com.google.uid.shared" in you apps manifest, and push your app to system/app . 如果您的固件是4.3+,那么您应该在应用程序清单中添加android:sharedUserId="com.google.uid.shared" ,并将您的应用程序推送到系统/应用程序

For this you can root your device But after adding this, your will not get installed, as during installation verifySignaturesLP method from PackageManagerService will return false as your app isn't signed with google signatures, so you have to make changes in that method to check you apps package and return true there. 为此,您可以为您的设备启用但是在添加之后,您将无法安装,因为在安装过程中,来自PackageManagerService的verifySignaturesLP方法将返回false,因为您的应用未使用google签名进行签名,因此您必须在该方法中进行更改以进行检查你的应用程序包并在那里返回true。

You are getting that error because your app have not signatures matching to those of Google. 您收到该错误的原因是您的应用没有与Google相匹配的签名。 Though you have signed your app using *.pk, but that/those file/s doesn't contain signature that Google uses to sign their app. 虽然您已使用* .pk对您的应用进行了签名,但该/ /那些文件/ s不包含Google用于签署其应用的签名。

So to install your app, you need to modify your framework code as I mentioned previously. 因此,要安装您的应用程序,您需要修改您之前提到的框架代码。 eg you can modify your verifySignaturesLP method to return true for your application. 例如,您可以修改verifySignaturesLP方法,以便为您的应用程序返回true。

Or second option If you are not able to do so, then I'm not sure, but you can try another thing. 或者第二种选择如果你不能这样做,那么我不确定,但你可以尝试另一种方法。 Instead of using that shared id use, shared id of other system applications in your device. 而不是使用共享ID使用,设备中其他系统应用程序的共享ID。 eg I used android:sharedUserId="android.uid.system" Then make your device permissive by giving below commands 例如,我使用了android:sharedUserId="android.uid.system"然后通过给出下面的命令让你的设备允许

1. adb shell
2. setenforce 0

Remember you should get Permissive instead of Enforcing for getenforce after above commands. 请记住,在上述命令之后,您应该获得Permissive而不是执行 getenforce And then try. 然后试试。 I'm not 100% sure about this second option. 我对第二种选择并不是100%肯定。 Hope this second option works in your case. 希望第二个选项适用于您的情况。

如果你使用KitKat(4.4),那么将你的apk放在/ system / priv-app而不是/ system / app。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM