jadx icon indicating copy to clipboard operation
jadx copied to clipboard

[gui] Failed to apply cached usage data — Method not found: android.R$integer.addView()

Open FlutterGenerator opened this issue 2 weeks ago • 1 comments

Issue details

Hello JADX developers!

I have encountered a problem when decompiling an APK using JADX GUI on Windows.

The following error appears:

ERROR: Failed to apply cached usage data

java.lang.RuntimeException: Method not found: android.R$integer.addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V

I tested several JADX versions:

  • 1.5.3
  • 1.5.4
  • 1.5.5
  • 1.5.6

The same error occurs in all tested versions.

The referenced Android class changes between versions (android.R$integer, android.R$anim, android.R$color), but the missing method is always addView().

The stack trace points to:

  • UsageData.java
  • RootNode.java
  • UsageInfoVisitor.java

Could you please investigate this issue?

Is this a problem with the usage data cache, or is JADX incorrectly resolving Android method references?

Thank you for your work!

Jadx version

1.5.6

Java version

25.0.5

OS

  • [x] Windows
  • [ ] Linux
  • [ ] macOS

FlutterGenerator avatar Nov 16 '26 18:11 FlutterGenerator

Can you provide the APK sample that causes this issue?

If you have stack trace please post it fully (from Jadx version 1.5.6 or latest unstable version).

jpstotz avatar Nov 16 '26 19:11 jpstotz

Can you provide the APK sample that causes this issue?

If you have stack trace please post it fully (from Jadx version 1.5.6 or latest unstable version).

Hi! I can provide the APK sample that reproduces this issue. I'll attach the APK here so you can investigate the problem. Please let me know if you also need the full stack trace or any additional information. Thanks for your work on JADX!

MT Manager_2.14.5-clone-MOD-v6-xml-fix-final.zip @jpstotz

FlutterGenerator avatar Nov 18 '26 05:11 FlutterGenerator

Can you provide the APK sample that causes this issue? If you have stack trace please post it fully (from Jadx version 1.5.6 or latest unstable version).

Hi! I can provide the APK sample that reproduces this issue. I'll attach the APK here so you can investigate the problem. Please let me know if you also need the full stack trace or any additional information. Thanks for your work on JADX!

MT Manager_2.14.5-clone-MOD-v6-xml-fix-final.zip @jpstotz

https://github.com/user-attachments/assets/ddae56b9-c00f-4056-988c-23951bc00985

@skylot @jpstotz

FlutterGenerator avatar Nov 18 '26 06:11 FlutterGenerator

@FlutterGenerator I would have preferred the text of the stack trace instead of a video. From a video you can't copy the stack trace text.

Using 1.5.6 and or latest unstable version I see a several errors in Jadx that may be worth investigation (not direct decompile errors) but the error you have posted does not occur. Do you have plugins installed? Or the configuration is different. Please post the content of Preferences -> Copy to clipboard.

ERROR: IllegalArgumentException in pass: ConstructorVisitor in method: l.۟۬۟.ۥ(android.content.Context, android.content.res.Resources, android.content.res.Resources$Theme, android.util.AttributeSet, android.animation.ObjectAnimator, android.content.res.XmlResourceParser):android.animation.ValueAnimator, file: classes2.dex
java.lang.IllegalArgumentException: Illegal Capacity: -1
	at java.base/java.util.ArrayList.<init>(ArrayList.java:160)
	at jadx.core.dex.nodes.InsnNode.<init>(InsnNode.java:36)
	at jadx.core.dex.instructions.BaseInvokeNode.<init>(BaseInvokeNode.java:11)
	at jadx.core.dex.instructions.mods.ConstructorInsn.<init>(ConstructorInsn.java:32)
	at jadx.core.dex.visitors.ConstructorVisitor.processInvoke(ConstructorVisitor.java:76)
	at jadx.core.dex.visitors.ConstructorVisitor.replaceInvoke(ConstructorVisitor.java:56)
	at jadx.core.dex.visitors.ConstructorVisitor.visit(ConstructorVisitor.java:42)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:25)
	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:13)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:13)
	at jadx.core.ProcessClass.process(ProcessClass.java:83)
	at jadx.core.ProcessClass.generateCode(ProcessClass.java:119)
	at jadx.core.dex.nodes.ClassNode.generateClassCode(ClassNode.java:401)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:389)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:307)
	at jadx.api.JavaClass.load(JavaClass.java:142)
	at jadx.api.JavaClass.decompile(JavaClass.java:66)
	at jadx.gui.jobs.DecompileTask.lambda$getJobs$0(DecompileTask.java:85)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:198)
	at jadx.core.utils.tasks.TaskExecutor.lambda$runStages$0(TaskExecutor.java:179)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

The following error happens because jadx.core.dex.visitors.regions.maker.SwitchRegionMaker#insertBreaksForCase tries to add a sub block region.getSubBlocks().add(buildBreakContainer(switchRegion)); but the region is on type SwitchRegion which returns in getSubBlocks an unmodifiableList.

ERROR: UnsupportedOperationException in pass: RegionMakerVisitor in method: l.ۗۤۖۥ.ۤ(l.ۤۤۖۥ):int, file: classes3.dex
java.lang.UnsupportedOperationException
	at java.base/java.util.Collections$UnmodifiableCollection.add(Collections.java:1092)
	at jadx.core.dex.visitors.regions.maker.SwitchRegionMaker$1.leaveRegion(SwitchRegionMaker.java:419)
	at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseInternal(DepthRegionTraversal.java:91)
	at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverse(DepthRegionTraversal.java:31)
	at jadx.core.dex.visitors.regions.maker.SwitchRegionMaker.insertBreaksForCase(SwitchRegionMaker.java:399)
	at jadx.core.dex.visitors.regions.maker.SwitchRegionMaker.insertBreaks(SwitchRegionMaker.java:89)
	at jadx.core.dex.visitors.regions.PostProcessRegions.leaveRegion(PostProcessRegions.java:31)
	at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverseInternal(DepthRegionTraversal.java:91)
	at jadx.core.dex.visitors.regions.DepthRegionTraversal.traverse(DepthRegionTraversal.java:27)
	at jadx.core.dex.visitors.regions.PostProcessRegions.process(PostProcessRegions.java:21)
	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:31)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:25)
	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:13)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:13)
	at jadx.core.ProcessClass.process(ProcessClass.java:83)
	at jadx.core.ProcessClass.generateCode(ProcessClass.java:119)
	at jadx.core.dex.nodes.ClassNode.generateClassCode(ClassNode.java:401)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:389)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:307)
	at jadx.api.JavaClass.load(JavaClass.java:142)
	at jadx.api.JavaClass.decompile(JavaClass.java:66)
	at jadx.gui.jobs.DecompileTask.lambda$getJobs$0(DecompileTask.java:85)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:198)
	at jadx.core.utils.tasks.TaskExecutor.lambda$runStages$0(TaskExecutor.java:179)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
	at jadx.core.dex.visitors.ssa.RenameState.startVar(RenameState.java:58)
	at jadx.core.dex.visitors.ssa.RenameState.init(RenameState.java:28)
	at jadx.core.dex.visitors.ssa.SSATransform.renameVariables(SSATransform.java:123)
	at jadx.core.dex.visitors.ssa.SSATransform.process(SSATransform.java:57)
	at jadx.core.dex.visitors.ssa.SSATransform.visit(SSATransform.java:44)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:25)
	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:13)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:13)
	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$0(DepthTraversal.java:12)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:12)
	at jadx.core.ProcessClass.process(ProcessClass.java:83)
	at jadx.core.ProcessClass.generateCode(ProcessClass.java:127)
	at jadx.core.dex.nodes.ClassNode.generateClassCode(ClassNode.java:401)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:389)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:307)
	at jadx.api.JavaClass.load(JavaClass.java:142)
	at jadx.api.JavaClass.decompile(JavaClass.java:66)
	at jadx.gui.jobs.DecompileTask.lambda$getJobs$0(DecompileTask.java:85)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:198)
	at jadx.core.utils.tasks.TaskExecutor.lambda$runStages$0(TaskExecutor.java:179)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
ERROR: NullPointerException in pass: ConstructorVisitor in method: l.۟ۜۢ.<init>(l.ۖ۟ۢ, android.view.ViewGroup):void, file: classes4.dex
java.lang.NullPointerException: Cannot invoke "jadx.core.dex.instructions.args.RegisterArg.sameRegAndSVar(jadx.core.dex.instructions.args.InsnArg)" because "resultArg" is null
	at jadx.core.dex.visitors.MoveInlineVisitor.processMove(MoveInlineVisitor.java:52)
	at jadx.core.dex.visitors.MoveInlineVisitor.moveInline(MoveInlineVisitor.java:41)
	at jadx.core.dex.visitors.ConstructorVisitor.visit(ConstructorVisitor.java:43)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:25)
	at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:13)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:13)
	at jadx.core.ProcessClass.process(ProcessClass.java:83)
	at jadx.core.ProcessClass.generateCode(ProcessClass.java:119)
	at jadx.core.dex.nodes.ClassNode.generateClassCode(ClassNode.java:401)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:389)
	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:307)
	at jadx.api.JavaClass.load(JavaClass.java:142)
	at jadx.api.JavaClass.decompile(JavaClass.java:66)
	at jadx.gui.jobs.DecompileTask.lambda$getJobs$0(DecompileTask.java:85)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:198)
	at jadx.core.utils.tasks.TaskExecutor.lambda$runStages$0(TaskExecutor.java:179)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

jpstotz avatar Nov 18 '26 10:11 jpstotz

ERROR: Failed to apply cached usage data
java.lang.RuntimeException: Method not found: android.R$color.addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V
	at jadx.core.dex.nodes.RootNode.resolveDirectMethod(RootNode.java:611)
	at jadx.gui.cache.usage.UsageData.lambda$resolveMthList$0(UsageData.java:88)
	at jadx.core.utils.Utils.collectionMap(Utils.java:352)
	at jadx.gui.cache.usage.UsageData.resolveMthList(UsageData.java:88)
	at jadx.gui.cache.usage.UsageData.applyForClass(UsageData.java:57)
	at jadx.gui.cache.usage.UsageData.apply(UsageData.java:38)
	at jadx.core.dex.visitors.usage.UsageInfoVisitor.apply(UsageInfoVisitor.java:72)
	at jadx.core.dex.visitors.usage.UsageInfoVisitor.init(UsageInfoVisitor.java:59)
	at jadx.core.dex.nodes.RootNode.runPreDecompileStage(RootNode.java:376)
	at jadx.api.JadxDecompiler.load(JadxDecompiler.java:136)
	at jadx.gui.JadxWrapper.open(JadxWrapper.java:82)
	at jadx.gui.ui.MainWindow.lambda$loadFiles$6(MainWindow.java:544)
	at jadx.core.utils.tasks.TaskExecutor.wrapTask(TaskExecutor.java:198)
	at jadx.core.utils.tasks.TaskExecutor.runStages(TaskExecutor.java:173)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)

FlutterGenerator avatar Nov 18 '26 14:11 FlutterGenerator

Seems like Jadx tries to use an old cache that doesn't match the apk file you have opened. Not sure how this had happened.

Simply clear the cache and repopen the APK file in Jadx.

jpstotz avatar Nov 19 '26 10:11 jpstotz

Seems like Jadx tries to use an old cache that doesn't match the apk file you have opened. Not sure how this had happened.

Simply clear the cache and repopen the APK file in Jadx.

I cleared the cache didn't help @jpstotz

FlutterGenerator avatar Nov 20 '26 17:11 FlutterGenerator

@FlutterGenerator The error Failed to apply cached usage data seem to occur only when "Usage data cache mode" is set to "DISK". As workaround you can set it to MEMORY.

If I delete assets/res.zip from the APK file I don't get the error. My guess is that the Jadx disk usage cache is somehow confused when it encounters all the duplicate classes that are contained in the res.zip file. It also contains the class android.R,. but this class is only present in the res.zip not in the apk. Also if you extract the res.zip file and load it alone into Jadx I don't get an error when decompiling it's classes.

jpstotz avatar Nov 21 '26 14:11 jpstotz