Assets inside PAK file work, but previous files not valid after mounting on Android, but Work for Windows

Hello Unreal Engine developers,

I’m facing an issue with mounting a PAK file on Android. After successfully mounting the PAK file, the assets contained within it work as expected. However, I’ve noticed that the previously existing files (those not included in the PAK file, located in the base directory) are no longer valid on Android. Strangely, on Windows, everything functions correctly.

Here’s the relevant code I’m using for mounting the .pak file:

bool AMyGameMode::MountPakFile(FString PakFilePath, const FString& PakFileName)
{
    bool bIsSuccess = false;

    if(!PakFilePath.EndsWith(TEXT("/")))
    {
        PakFilePath += TEXT("/");
    }

    const FString FullPakFilePath =  PakFilePath + PakFileName + TEXT(".pak");
    LogWriteMessage(FString::Printf(TEXT("PakFile Path: %s"), *FullPakFilePath), FColor::Green);

    IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
    FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
    PakPlatformFile->Initialize(&PlatformFile, TEXT(""));

    if(PlatformFile.FileExists(*FullPakFilePath))
    {
        LogWriteMessage(TEXT("PakFile Exists"), FColor::Green);

        FPlatformFileManager::Get().SetPlatformFile(*PakPlatformFile);

        bIsSuccess = PakPlatformFile->Mount(*FullPakFilePath, 0, NULL);
        if(bIsSuccess)
        {
            LogWriteMessage(("PakFile Mounted Successfully"), FColor::Green);
        }
        else
        {
            LogWriteMessage(("PakFile Mount Failed"), FColor::Red);
        }
    }
    else
    {
        LogWriteMessage(TEXT("PakFile Does not Exist"), FColor::Red);
    }

    return bIsSuccess;
}

When I call the MountPakFile function on Android, passing the following parameters:

MountPakFile(TEXT(“/data/data/com.package.name/files/assetpacks/pakchunk1/41/41/assets/”), TEXT(“pakchunk1”));

And on Windows, with the parameters:

MountPakFile(TEXT(“E:\UE4 Packages\UltimateAppTest\PakFile”), TEXT(“pakchunk1”));

On both platforms, the mount operation is successful, as indicated by the log messages. However, on Android, I’ve noticed that the assets inside the mounted PAK file work fine, while the previously existing files (outside the PAK file) are not valid anymore. These files were working perfectly before mounting on Android.

I have double-checked the file paths and made sure that the PAK file exists at the specified location on both platforms. However, it seems that the mounting process is somehow affecting the accessibility of the base files on Android.

Has anyone encountered a similar issue or can provide insights into why this discrepancy might be happening? I’m particularly interested in understanding why the files outside the PAK file are no longer valid on Android, while the assets inside the PAK file function correctly.

Any help or suggestions would be greatly appreciated!

Thank you in advance.