An embodiment of the present invention provides a resource loading method, apparatus, electronic device, and computer-readable storage medium, which relate to the field of Internet technologies. The method obtains a resource loading request sent by an application program. The resource loading request carries a target compressed
package identifier and a target relative path. According to the target compressed
package identifier, the local compressed
package corresponding to the target
resource file is obtained. After the signature
verification of the local compressed package is correct, the target
resource file is decompressed from the local compressed package according to the target relative path, and the target
resource file is returned to the application program for loading. Based on the target compressed
package identifier and the target relative path carried in the resource loading request, only the resource files that need to be loaded are decompressed from the local compressed package, and the resource files that are not temporarily used will not be decompressed. Moreover, the decompressed resource files are data that have passed the signature
verification of the compressed package. Therefore, on-demand and secure loading of resource files can be achieved, with lower memory occupancy and faster resource loading speed.