Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:22:04+00:00 2026-06-05T15:22:04+00:00

Has anyone ever used the hidden class PackageParser in Android source code with java

  • 0

Has anyone ever used the hidden class PackageParser in Android source code with java reflection?

I can get this class and its method collectCertificates() in the reflection way, but I keep getting the NoSuchMethodException with its method generatePackageInfo().

I am wondering whether the following sentence causes that problem, since I am not so sure about the usage of int[].class:

partypesGeneratePackageInfo[1] = int[].class;

Here is my code:

    private PackageInfo parsePackage(String archiveFilePath, int flags)
        throws Exception, Exception {
    // get class:PackageParser
    Class clsPackageParser = Class
            .forName("android.content.pm.PackageParser");

            ......      

    // get method:collectCertificates
    Class partypesCollectCertificates[] = new Class[2];
    partypesCollectCertificates[0] = clsPackage;
    partypesCollectCertificates[1] = int.class;
    Method methCollectCertificates = clsPackageParser.getMethod(
            "collectCertificates", partypesCollectCertificates);

    // invoke method:collectCertificates
    Object arglistMethCollectCertificates[] = new Object[2];
    arglistMethCollectCertificates[0] = objPackage;
    arglistMethCollectCertificates[1] = flags;
    methCollectCertificates.invoke(objPackageParser,
            arglistMethCollectCertificates);

    // get method:generatePackageInfo
    Class partypesGeneratePackageInfo[] = new Class[3];
    partypesGeneratePackageInfo[0] = clsPackage;
    partypesGeneratePackageInfo[1] = int[].class;
    partypesGeneratePackageInfo[2] = int.class;
    Method methGeneratePackageInfo = clsPackageParser.getMethod(
            "generatePackageInfo", partypesGeneratePackageInfo);

    ......
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:22:05+00:00Added an answer on June 5, 2026 at 3:22 pm

    For what I can see, the declaration for generatePackageInfo is:

    public static PackageInfo generatePackageInfo(PackageParser.Package p,
            int gids[], int flags, long firstInstallTime, long lastUpdateTime) {
    

    So that’s 5 parameters: PackageParser.Package.class, int[].class, int.class, long.class, long.class.

    Since this is not an exposed API, it could very well be that the number of parameters changes from version to version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone ever heard of overriding too many classes in Java? Perhaps this issue
Has anyone ever used a series of tables togather called a DECODE? This is
Has anyone ever used Multimaps on Android is it possible?
Hey has anyone ever used the API for face detect in their android program?
Has anyone ever seen the storage class auto explicitly used in C/C++? If so,
Has anyone of you ever used php_writeexcel (http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/)? I would like to know if
Has anyone ever seen this? I don't how to expand on this. It's the
Has anyone ever used Solrnet inside CLR Stored Procedures? I would really appreciate pointers
Just curious to know if anyone has ever used gametutorials.com products for learning directX.
Hey all, I'm wondering if anyone has ever used a tool which will take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.