gpt4 book ai didi

android - 使用 native react 生成未签名的 APK 导致错误 : verifyReleaseResources'

转载 作者:行者123 更新时间:2023-11-29 14:59:09 27 4
gpt4 key购买 nike

我正在尝试使用 React Native 生成​​未签名的 apk,但它不会生成,而且我遇到了一些错误。我确实检查了堆栈跟踪,但我无法弄清楚出了什么问题。有没有和我一样的问题?我已经被困在这里好几天了。

我安装了几个模块,例如:react-native-router-fluxreact-native-sqlite-storagereact-native-print

下面是堆栈跟踪:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-print:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-print:verifyReleaseResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.UncheckedException: com.android.ide.common.process.ProcessException: Failed to execute aapt
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 29 more
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797)
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.linkResources(VerifyLibraryResourcesTask.java:243)
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.compileAndVerifyResources(VerifyLibraryResourcesTask.java:140)
at com.android.build.gradle.tasks.VerifyLibraryResourcesTask.doFullTaskAction(VerifyLibraryResourcesTask.java:96)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
... 39 more
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\bayuw\AppData\Local\Android\Sdk\build-tools\27.0.3\aapt.exe with arguments {package -f --no-crunch -I C:\Users\bayuw\AppData\Local\Android\Sdk\platforms\android-23\android.jar -M \\?\C:\reactnative\training01\node_modules\react-native-print\android\build\intermediates\manifests\aapt\release\AndroidManifest.xml -S C:\reactnative\training01\node_modules\react-native-print\android\build\intermediates\res\merged\release --non-constant-id -0 apk --no-version-vectors}
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
... 45 more
Caused by: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\bayuw\AppData\Local\Android\Sdk\build-tools\27.0.3\aapt.exe with arguments {package -f --no-crunch -I C:\Users\bayuw\AppData\Local\Android\Sdk\platforms\android-23\android.jar -M \\?\C:\reactnative\training01\node_modules\react-native-print\android\build\intermediates\manifests\aapt\release\AndroidManifest.xml -S C:\reactnative\training01\node_modules\react-native-print\android\build\intermediates\res\merged\release --non-constant-id -0 apk --no-version-vectors}
at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1237)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48)
at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\bayuw\AppData\Local\Android\Sdk\build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46)
... 9 more


* Get more help at https://help.gradle.org

BUILD FAILED in 54s
104 actionable tasks: 3 executed, 101 up-to-date

构建.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false


def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.training01"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}

dependencies {
compile project(':react-native-print')
compile project(':react-native-camera')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.1.0"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-sqlite-storage')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

最佳答案

首先关闭所有正在运行的终端窗口。
尝试使用 npm uninstall react-native-print --save
删除库使用 npm unlink react-native-print
取消链接库之后使用 npm install react-native-print --save 重新安装库并使用 npm link react-native-print

android/build 文件夹中删除 build
最后从您的项目目录运行此脚本命令以获取 apk

mkdir -p android/app/src/main/assets && rm -rf android/app/build && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && cd android && ./gradlew assembleDebug

关于android - 使用 native react 生成未签名的 APK 导致错误 : verifyReleaseResources',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51740199/

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