title: Aapt2Exception: Android resource linking failed Output: error: failed to open APK: Invalid file
body: <p><strong>Device Info:</strong></p>
  
  <p>windows 10
  Android Studio 3.2 or 3.1</p>
  
  <pre><code>distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip  
  classpath 'com.android.tools.build:gradle:3.2.0'
  </code></pre>
  
  <p><strong>Question:</strong>
  When I create a new Android Project,rebuilding cause this error.  I cannot find the solution in google or stackoverflow.  The error Log is
   "Aapt2Exception: Android resource linking failed  Output:  error: failed to open APK: Invalid file."
  I don't know which APK a building need "open",and cannot find the key point.</p>
  
  <p>I think maybe something wrong with my pc.
  Can Anyone help?</p>
  
  <p><strong>log:</strong></p>
  
  <pre><code>com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  **Output:  error: failed to open APK: Invalid file.**
  
  Command: C:\Users\RABBIT\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\1f6bc70d6f61581570fe3ce3ff0cfffc\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
          D:\RA\PROGRAM\AndroidSDK\platforms\android-28\android.jar\
          --manifest\
          D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          D:\RA\CODE\RA_CODE\Aapt2Test\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.aapt.rabbit.aapttest\
          -0\
          apk\
          --output-text-symbols\
          D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
      at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2DaemonImpl.kt:177)
      at com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.kt:103)
      at com.android.builder.internal.aapt.v2.Aapt2DaemonManager$LeasedAaptDaemon.link(Aapt2DaemonManager.kt:176)
      at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:823)
      at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:525)
      at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.java:275)
      at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
  </code></pre>