Skip to content

bug: XmlEncodeException: Resource not found when patching with WPS Office #519

@shaktimaan0707

Description

@shaktimaan0707

Bug description

Patching fails with a resource resolution error during the APK repackaging stage. The patcher attempts to encode a string that references an external WPS Office resource which cannot be found in the available frameworks.

Suspected Cause:
The patch includes a cross-package resource reference to cn.wps.moffice_eng:string/allow, but this external package's resources are not available in the patcher's framework list (only android-35 is loaded). The resource cannot be resolved, causing the XML encoding step to fail.

Steps to Reproduce:

  • Select the relevant patch in Morphe Manager
  • Apply the patch to the target APK
  • Error occurs during resource encoding phase

Version of Morphe (Manager) and the app you are patching

Morphe Version: 1.16.0
App Version: 18.24

Morphe logs

com.reandroid.arsc.coder.xml.XmlEncodeException: at /data/user/0/app.morphe.manager/app_ephemeral/patcher/apk/resources/package_1/res/values/strings.xml [line = 35]
Resource not found for: '@cn.wps.moffice_eng:string/allow', frameworks size=1 [android-35]: <string name="note_allow">@cn.wps.moffice_eng:string/allow</string>
	at com.reandroid.arsc.coder.xml.XmlCoder$ValuesXml.encode(SourceFile:281)
	at com.reandroid.arsc.coder.xml.XmlCoder$ValuesXml.encode(SourceFile:256)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.encodeValuesDir(SourceFile:318)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.encodeResDir(SourceFile:280)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.encodeValues(SourceFile:184)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.scanResourceFiles(SourceFile:112)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.scanResourcesDirectory(SourceFile:87)
	at com.reandroid.apk.xmlencoder.XMLTableBlockEncoder.scanMainDirectory(SourceFile:83)
	at com.reandroid.apk.ApkModuleXmlEncoder.buildTableBlock(SourceFile:56)
	at com.reandroid.apk.ApkModuleXmlEncoder.buildResources(SourceFile:45)
	at com.reandroid.apk.ApkModuleEncoder.scanDirectory(SourceFile:45)
	at app.morphe.patcher.resource.coder.ArsclibResourceCoder.encodeResources(SourceFile:292)
	at app.morphe.patcher.patch.ResourcePatchContext.get(SourceFile:80)
	at app.morphe.patcher.Patcher.get(SourceFile:176)
	at app.morphe.manager.patcher.Session$run$result$1.invokeSuspend(SourceFile:106)
	at app.morphe.manager.patcher.Session$run$result$1.invoke(SourceFile:0)
	at app.morphe.manager.patcher.Session$run$result$1.invoke(SourceFile:0)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndspatched(SourceFile:66)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(SourceFile:43)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(SourceFile:165)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
	at app.morphe.manager.patcher.Session.run(SourceFile:103)
	at app.morphe.manager.patcher.runtime.process.PatcherProcess$start$1.invokeSuspend(SourceFile:117)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:34)
	at kotlinx.coroutines.DispatchedTask.run(SourceFile:100)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(SourceFile:829)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(SourceFile:717)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:704)

Acknowledgements

  • I have checked all open and closed bug reports and this is not a duplicate.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
  • The bug only affects using Morphe (Manager)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions