开发者

Class not found : PackageParser when using PackageInstaller from git

开发者 https://www.devze.com 2023-03-13 01:09 出处:网络
This is a very precise question about the p开发者_如何转开发ackage installer open source project hosted on google code project: http://android.amberfog.com/?p=98

This is a very precise question about the p开发者_如何转开发ackage installer open source project hosted on google code project: http://android.amberfog.com/?p=98

When I try to compile it, I get a ClassNotFoundException exception for this class: android.content.pm.PackageParser.

I don't really understand what happens as this class is part of android sdk but not documented in android docs.

Did someone use that package before and knows how to compile it?


UPDATED

You are trying to compile the PackageInstaller application, which is the application that Google ships as a part of the Android system, and which uses some API that are hidden from public SDK (like android.content.pm.PackageParser). There are few techniques available for accessing that hidden API, but even if you were able to compile PackageInstaller it won't run because it requires few permissions (like android.permission.INSTALL_PACKAGES) that can be granted to the application only when it's signed with the System certificate. And only vendor of the device can do that.

But let me ask you, why do you need to compile PackageInstaller app? The author of the article at http://android.amberfog.com/?p=98 shows how to install/uninstall the .apk by sending the Intent to Google PackageInstaller application. You don't need to recompile PackageInstaller to be able to do that.


I guess you have to pull out all the android code from the repository and compile it. You can try download only the class you need and all it's dependencies.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号