gpt4 book ai didi

android - 为 Android 构建应用程序时任务 ':mergeF0F1F2F3DebugResources' 执行失败

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:03 31 4
gpt4 key购买 nike

尝试在 Android 上构建/运行我的 NativeScript 应用程序时,我不断收到错误消息。我已经尝试删除平台并读取它,还删除所有 node_modules 并再次添加它们。 iOS 版本运行良好,只是 Android 版本在 atm 上有问题。

我的 App.gradle:

android {  
defaultConfig {
generatedDensities = []
applicationId = %my_projectname%
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.0.+'
}
}
}
}
}

来 self 的 package.json:

"nativescript": {
"id": %my_projectname%,
"tns-ios": {
"version": "3.1.0"
},
"tns-android": {
"version": "3.0.0"
}
}

错误:

14:04:01.299 [QUIET] [system.out] Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
14:04:01.301 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
14:04:01.302 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':mergeF0F1F2F3DebugResources'
14:04:01.302 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :mergeF0F1F2F3DebugResources FAILED
14:04:01.302 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :mergeF0F1F2F3DebugResources (Thread[Daemon worker,5,main]) completed. Took 5.389 secs.
14:04:01.302 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.45 completed (0 in use)
14:04:01.303 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker,5,main]] finished, busy: 32.075 secs, idle: 0.116 secs
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':mergeF0F1F2F3DebugResources'.
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:04:01.304 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
14:04:01.305 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mergeF0F1F2F3DebugResources'.
14:04:01.305 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
14:04:01.305 [ERROR]
....
14:04:01.319 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.builder.png.AaptProcess$ProcessOutputFacade.out(AaptProcess.java:215)
14:04:01.319 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.utils.GrabProcessOutput$2.run(GrabProcessOutput.java:143)
14:04:01.319 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:04:01.319 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger]
14:04:01.319 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED
14:04:01.319 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger]
14:04:01.320 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] Total time: 57.585 secs
14:04:01.333 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for task history cache (C:\Dev\biff\HandyApp\platforms\android\.gradle\3.3\taskArtifacts)
14:04:01.334 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskArtifacts.bin (C:\Dev\biff\HandyApp\platforms\android\.gradle\3.3\taskArtifacts\taskArtifacts.bin)
14:04:01.335 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache fileHashes.bin (C:\Dev\biff\HandyApp\platforms\android\.gradle\3.3\taskArtifacts\fileHashes.bin)
14:04:01.335 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache fileSnapshots.bin (C:\Dev\biff\HandyApp\platforms\android\.gradle\3.3\taskArtifacts\fileSnapshots.bin)
14:04:01.335 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task history cache (C:\Dev\biff\HandyApp\platforms\android\.gradle\3.3\taskArtifacts).
14:04:01.336 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
14:04:01.337 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 4 (avg: 0.017 secs, total: 0.071 secs)
14:04:01.337 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 2 resolution results binary files in 0.002 secs
14:04:01.337 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Plugin Resolution Cache (C:\Users\frr\.gradle\caches\3.3\plugin-resolution) was closed 0 times.
14:04:01.338 [DEBUG] [org.gradle.process.internal.daemon.WorkerDaemonManager] Stopping 0 worker daemon(s).
14:04:01.338 [INFO] [org.gradle.process.internal.daemon.WorkerDaemonManager] Stopped 0 worker daemon(s).
14:04:01.338 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Generated Gradle JARs cache (C:\Users\frr\.gradle\caches\3.3\generated-gradle-jars) was closed 0 times.
14:04:01.338 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for artifact cache (C:\Users\frr\.gradle\caches\modules-2)
14:04:01.338 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-repository.bin (C:\Users\frr\.gradle\caches\modules-2\metadata-2.23\artifact-at-repository.bin)
14:04:01.338 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (C:\Users\frr\.gradle\caches\modules-2\metadata-2.23\module-metadata.bin)
14:04:01.338 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifacts.bin (C:\Users\frr\.gradle\caches\modules-2\metadata-2.23\module-artifacts.bin)
14:04:01.338 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-versions.bin (C:\Users\frr\.gradle\caches\modules-2\metadata-2.23\module-versions.bin)
14:04:01.338 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (C:\Users\frr\.gradle\caches\modules-2).
14:04:01.339 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
14:04:11.602 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@2e425d92
14:04:18.343 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 14: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
14:04:18.346 [INFO] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':mergeF0F1F2F3DebugResources'.] from daemon DaemonInfo{pid=6744, address=[c1153b93-8604-4b5b-acb4-2dd6530b37a1 port:49887, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1504872097503, context=DefaultDaemonContext[uid=5919326b-2ad7-481d-93a3-189f8cd671ee,javaHome=C:\Program Files\Java\jdk1.8.0_144,daemonRegistryDir=C:\Users\frr\.gradle\daemon,pid=6744,idleTimeout=10800000,daemonOpts=-Xmx16384M,-Dfile.encoding=windows-1252,-Duser.country=DE,-Duser.language=de,-Duser.variant]} (build should be done).
14:04:18.346 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
14:04:18.349 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
Error: Command gradlew.bat failed with exit code 1
at ChildProcess.childProcess.on

更新:-------------------------------------------- ------

来 self 的 Manifest.xml:

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>

我使用 splash_screen.png 作为启动屏幕。

来 self 的 styles.xml:

<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>

<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>

<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>

<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>

<item name="android:windowFullscreen">true</item>
</style>

错误仅在我交换 splash_screen.png 时出现。我插入了我在旧版本中使用的那个,效果非常好。在我的 drawable-folders 中,我证明了 splash_screen.pngicon.png(应用程序图标)。当我更改 icon.png 时没有问题,只是 splash_screen 似乎产生了问题,我不明白为什么。

最佳答案

找到这个问题的解决方案:

gradle assemble -info 提示 Manifests 有不同的 SDK 版本,不能合并。

我需要编辑我的 Manifests 和 build.gradle 文件,然后一切都恢复正常了。

为了清楚起见,您需要编辑 AndroidManifest.xml 中的 uses-sdk

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

和 android 部分,特别是 build.gradle 文件中的 minSdkVersion 和 targetSdkVersion

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}

请检查您是否已关闭应用程序标签。这也是此错误的可能原因:如果不是,请使用此:

</application>

我已经看到你更新的帖子了。这似乎是一个命名约定问题。请重命名所有可绘制文件夹的图像,并检查所有可绘制文件夹中的图像是否为 png。谢谢

关于android - 为 Android 构建应用程序时任务 ':mergeF0F1F2F3DebugResources' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46116292/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com