Asset validation failed

Hi

I am trying to upload an App to the App Store. It is a Java application with a small Swift wrapper. I build for both arm64 and x86-64 and include JREs for both architectures inside the bundle.

The Launcher App:

@main
struct LauncherApp {
   
  static let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "drrename")
   
  static func main() {
     
    var jrePath: String = ""
     
#if arch(arm64)
    if let jrePathArm64 = Bundle.main.path(forResource: "jre-18.0.1_10_arm64/Contents/Home/bin/java", ofType: ""){
      jrePath = jrePathArm64
    }
     
#elseif arch(x86_64)
    if let jrePathX86 = Bundle.main.path(forResource: "jre-18.0.1_10_x64/Contents/Home/bin/java", ofType: ""){
      jrePath = jrePathX86
    }
     
#endif
     
    if jrePath != "" {
      logger.log("Got jre path: \(jrePath)")
      if let jarPath = Bundle.main.path(forResource: "drrename-0.6.4-SNAPSHOT", ofType: "jar"){
        logger.log("Got jar path: \(jarPath)")
        let task = Process()
        task.launchPath = jrePath
        task.arguments = ["-jar", jarPath]
        task.launch()
        task.waitUntilExit()
      } else {
        logger.critical("Failed to get jar path")
      }
    } else {
      logger.critical("Failed to get jre path")
    }
  }
}

I get the following error:

I understand that both arm and x86 are required, that is why I package both x86-64 and arm64 JREs inside the bundle.

How can I resolve this error?

Many thanks!

The traditional way to resolve this is to merge the Intel and Apple silicon Mach-O images into a single universal binary. Doing that for a simple library is easy. I’ve no idea whether it’s feasible for a Java runtime. That’s something you should ask your runtime’s vendor.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks @eskimo for your reply!

to merge the Intel and Apple silicon Mach-O images into a single universal binary.

I thought that would only apply for the main executable as defined in the Info.plist, by the CFBundleExecutable key.

So do I understand correctly, that there is no way to package libraries for both arch types separately in a bundle? Technically this should work but apparently the validator will not understand this setup.

that there is no way to package libraries for both arch types separately in a bundle?

I don’t know for sure. As you say, this isn’t a problem at runtime, which is my specialism, but rather an artefact of the App Store Connection ingestion process. I’m not aware of any way to override that, but I might have missed a memo.

If you’re unable to fix this on the Java side, I recommend that you talk to the App Store Connect folks about it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Asset validation failed
 
 
Q