设备信息:
windows 10 Android Studio 3.2或3.1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
classpath 'com.android.tools.build:gradle:3.2.0'
问题: 当我创建一个新的Android项目时,重建会导致此错误。我在Google或stackoverflow中找不到解决方案。错误日志是 “ Aapt2Exception:Android资源链接失败输出:错误:无法打开APK:无效文件。” 我不知道建筑物需要打开哪个APK,也找不到关键点。
我认为我的电脑可能出了点问题。 有人可以帮忙吗?
日志:
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)