-2

Caused by: java.lang.AssertionError at com.android.tools.r8.ir.code.IntSwitch.valid(IntSwitch.java:67) at com.android.tools.r8.ir.code.IntSwitch.(IntSwitch.java:35) at com.android.tools.r8.ir.conversion.IRBuilder.createSwitch(IRBuilder.java:1922) at com.android.tools.r8.ir.conversion.IRBuilder.addSwitch(IRBuilder.java:1886) at com.android.tools.r8.cf.code.CfSwitch.buildIR(CfSwitch.java:101) at com.android.tools.r8.ir.conversion.CfSourceCode.build(CfSourceCode.java:581) Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.

java sample

 public IFactory getInjectMap(String var1) {
          byte var2 = -1;
          switch(var1.hashCode()) {
          case 2011670744:
             if (var1.equals("xxx.xxx.xxx.xxx")) {
                var2 = 0;
             }
             break;
          case -1047643106:
             if (var1.equals("xxx.xxx.xxx.xxx")) {
                var2 = 1;
             }
             break;
          }
    
          switch(var2) {
          case 0:
             var2 = (byte)(new xxxxFactory());
             break;
          case 1:
             var2 = (byte)(new xxxxFactory());
             break;
          default:
             var2 = (byte)null;
          }
    
          return var2;
       }
    }
  • Share your code – Yaqoob Bhatti Sep 21 '21 at 06:01
  • @YaqoobBhatti i just fix it thanks – daisukikancolle Sep 21 '21 at 07:50
  • 1
    The decompiler you’ve used seems to be fundamentally flawed, as it does not recognize that the variable initialized in the second `switch` must have a different type than the variable used in the first and even inserts nonsensical casts from reference types to `byte` based on this wrong assumption. Besides that, this seems to be a switch over strings, not recognized by the decompiler. The conclusion is that you should show the actual bytecode, rather than the result of this decompiler. – Holger Sep 21 '21 at 10:46

1 Answers1

0

The assertion error you hit is validating that the values in the lookupswitch instruction is ordered, as mandated by the JVM specification. This indicate that the generated bytecode is not following the specification. Does this code run on the JVM?

This is also reported as https://issuetracker.google.com/200284898#comment6.

sgjesse
  • 3,793
  • 14
  • 17