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 8038455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:14:31+00:00 2026-06-05T03:14:31+00:00

My apk version code is version 3. with it I am using main expansion

  • 0

My apk version code is version 3. with it I am using main expansion file which was loaded with apk version code 1 (file name is similar to main.1.ex.etc.eg.obb). The expansion file downloads fine on a device.

The expansion file has media file, so I using APEZProvider from the Google Zip Expansion Library to play it with VideoView.

Calling VideoView.start() causes an Nullpointer exception.

What I have found so far:
In APEZProvider.initIfNecessary() returns Main expansion file version as 3 instead of 1. Thus trying to open ZipResourceFile (mAPKExtensionFile) returns null. APEZProvider.openAssetFile() causes NullPointerException as mAPKExtensionFile is null.

Relevant code from APEZProvider class in Google Zip Expansion Library:

  private boolean initIfNecessary() {
    if ( !mInit ) {
        Context ctx = getContext();
        PackageManager pm = ctx.getPackageManager();
        ProviderInfo pi = pm.resolveContentProvider(getAuthority(), PackageManager.GET_META_DATA);
        PackageInfo packInfo;
        try {
            packInfo = pm.getPackageInfo(ctx.getPackageName(), 0);
        } catch (NameNotFoundException e1) {
            e1.printStackTrace();
            return false;
        }
        int patchFileVersion;
        int mainFileVersion;
        int appVersionCode = packInfo.versionCode;
        if ( null != pi.metaData ) {
            mainFileVersion = pi.metaData.getInt("mainVersion", appVersionCode);
            patchFileVersion = pi.metaData.getInt("patchVersion", appVersionCode);          
        } else {
            mainFileVersion = patchFileVersion = appVersionCode;
        }
        try {
            mAPKExtensionFile = APKExpansionSupport.getAPKExpansionZipFile(ctx, mainFileVersion, patchFileVersion);
            return true;
        } catch (IOException e) {
            e.printStackTrace();                
        }
    }
    return false;       
}



@Override
public AssetFileDescriptor openAssetFile(Uri uri, String mode)
        throws FileNotFoundException {
    initIfNecessary();
    String path = uri.getEncodedPath();
    if ( path.startsWith("/") ) {
        path = path.substring(1);
    }
    return mAPKExtensionFile.getAssetFileDescriptor(path);      
}

I am not sure about this line of code in the above: ProviderInfo pi = pm.resolveContentProvider(getAuthority(), PackageManager.GET_META_DATA); Is this correct?

From Android reference for PackageManager.resolveContentProvider().

public abstract ProviderInfo resolveContentProvider (String name, int flags)

Since: API Level 1
Find a single content provider by its base path name.
Parameters

name: The name of the provider to find.

flags: Additional option flags. Currently should always be 0.

Can someone confirm if i am doing something wrong or is it a bug.

Edit: everything works as expected when I upload my app for the first time – its only when I update the apk resulting in different version codes that this problem occurs.

  • 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-05T03:14:33+00:00Added an answer on June 5, 2026 at 3:14 am

    The Zip file provider class contains metadata that you can place in your AndroidManifest.zip file if the version number of the APK Expansion File does not match the version number of your APK.

    <provider android:name=".APEZProvider"
                  android:authorities="my.application.authority"
                  android:exported="false"
                  android:multiprocess="true"
        >
       <meta-data android:name="mainVersion"
                  android:value="1"></meta-data>
       <meta-data android:name="patchVersion"
                  android:value="2"></meta-data>
    </provider>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A buddy sent me a later version of an .apk file. I already had
Android stores it's programs in APK format, which is a modified version of ZIP/JAR.
how to Run Android Apk file automatically when android phone get unlock. Which BroadCast
The code that I am presently using is as follows: My main class public
I have following code for main layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent
I am using BroadcastReceiver class for receiving the sms. My main class code is:
I have been able to create a *.apk file from my code, place the
I want to display different images using gridview in android? Xml file: <?xml version=1.0
I am using concept of Android Expansion which helps us to remove obstacle of
The code I am using will display the Name and Number in the listview,

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.