Applications often use code obfuscation when packaging an APK for release. A patch will fail if the obfuscation results are inconsistent between the pre-fix and post-fix APKs. To ensure a successful patch, use the same mapping.txt file for both APKs. This guarantees identical obfuscation results.
Follow these steps if your application uses code obfuscation. You can skip these steps if your application does not use obfuscation.
In the pre-fix project, find the mapping.txt file. Because the -printmapping mapping.txt command is ineffective in recent Gradle versions, you must find the file in the build directory. The path is /build/outputs/mapping/release for a release package and
/build/outputs/mapping/debugfor a debug package. After you find the file, move it to the root directory of the current module.In the post-fix project, modify the proguard-rules.pro file to ensure consistent obfuscation results.
-applymapping mapping.txtThis command searches for the mapping.txt file in the directory of the current module. Make sure that the mapping.txt file is in this directory.