title: java.nio.file.InvalidPathException: Trailing char < > at index 10: res/raw/?
body: <p>I am facing this issue in android app bundle. I have created the android app bundle from android studio 3.4.2 successfully and now i want to build apks from that bundle using bundletool so later i can install the build using the bundletool. But when I am running this command which build apks from the bundle <code>java -jar bundletool-all-0.10.2.jar build-apks --bundle=D:\MyApp.aab --output=D:\all_apkk.apks --ks=keystorepath --ks-key-alias=aliasname --ks-pass=pass:pswrd. I am facing this Caused by: java.nio.file.InvalidPathException: Trailing char &lt; &gt; at index 10: res/raw/??.</code></p>
  
  <p>Here are the logs below.</p>
  
  <pre><code>WARNING: An illegal reflective access operation has occurred
  WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/C:/Program%20Files/Java/jdk-11.0.2/bin/bundletool-all-0.10.2.jar) to field java.nio.Buffer.address
  WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
  WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  WARNING: All illegal access operations will be denied in a future release
  [BT:0.10.2] Error: java.nio.file.InvalidPathException: Trailing char &lt; &gt; at index 10: res/raw/??
  java.lang.RuntimeException: java.nio.file.InvalidPathException: Trailing char &lt; &gt; at index 10: res/raw/??
          at com.android.tools.build.bundletool.io.ConcurrencyUtils.waitFor(ConcurrencyUtils.java:59)
          at com.android.tools.build.bundletool.io.ConcurrencyUtils.waitForAll(ConcurrencyUtils.java:42)
          at java.base/java.util.function.Function.lambda$andThen$1(Function.java:88)
          at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:582)
          at com.android.tools.build.bundletool.io.ApkSerializerManager.serializeApks(ApkSerializerManager.java:180)
          at com.android.tools.build.bundletool.io.ApkSerializerManager.populateApkSetBuilder(ApkSerializerManager.java:101)
          at com.android.tools.build.bundletool.commands.BuildApksManager.executeWithZip(BuildApksManager.java:229)
          at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:110)
          at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:524)
          at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:74)
          at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
  Caused by: java.util.concurrent.ExecutionException: java.nio.file.InvalidPathException: Trailing char &lt; &gt; at index 10: res/raw/??
          at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:502)
          at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:461)
          at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:83)
          at com.android.tools.build.bundletool.io.ConcurrencyUtils.waitFor(ConcurrencyUtils.java:49)
          ... 10 more
  Caused by: java.nio.file.InvalidPathException: Trailing char &lt; &gt; at index 10: res/raw/??
          at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:191)
          at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
          at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
          at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
          at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
          at java.base/java.nio.file.Path.of(Path.java:147)
          at java.base/java.nio.file.Paths.get(Paths.java:69)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.lambda$shouldCompress$4(ApkSerializerHelper.java:309)
          at java.base/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
          at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
          at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
          at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
          at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
          at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
          at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
          at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
          at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
          at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:528)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.shouldCompress(ApkSerializerHelper.java:309)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.entryOptionForPath(ApkSerializerHelper.java:294)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.writeProtoApk(ApkSerializerHelper.java:254)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.writeToZipFile(ApkSerializerHelper.java:155)
          at com.android.tools.build.bundletool.io.ApkSerializerHelper.writeToZipFile(ApkSerializerHelper.java:144)
          at com.android.tools.build.bundletool.io.SplitApkSerializer.writeToDisk(SplitApkSerializer.java:75)
          at com.android.tools.build.bundletool.io.SplitApkSerializer.writeSplitToDisk(SplitApkSerializer.java:53)
          at com.android.tools.build.bundletool.io.ApkSetBuilderFactory$ApkSetArchiveBuilder.addSplitApk(ApkSetBuilderFactory.java:105)
          at com.android.tools.build.bundletool.io.ApkSerializerManager$ApkSerializer.serialize(ApkSerializerManager.java:376)
          at com.android.tools.build.bundletool.io.ApkSerializerManager.lambda$null$3(ApkSerializerManager.java:184)
          at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:117)
          at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:38)
          at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  
  <p>So what I did after some research is I made a bundle e.g myApp.aab and convert the extension into the .zip which makes myApp.zip, Then I extract that and goes to the folder which is in the logs above (res/raw/) and there were a lot of files containing .xml files too.</p>
  
  <p>But what I have noticed is there are alot of .xml file whose names contain space at the end e.g -> file .xml (containing space after e). Then I figured out that why the exception in logs coming.</p>
  
  <p>Basically, I am using the dexguard obfuscation which is doing is leaving spaces at the end of the file while obfuscation. </p>
  
  <p>Now I want to know how can i prevent it ?</p>