- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个 Android 应用程序,该应用程序具有使用 ndk-build
构建的 native 库依赖项.反过来,该库取决于我添加到根目录 Android.mk
中的预构建静态库 (.a)如下。我打算只为 armeabi-v7a
构建和 arm64-v8a
.
ifeq ($(TARGET_ARCH), arm)
LOCAL_SRC_FILES := lib/mylib_arm.a
else ifeq ($(TARGET_ARCH), arm64)
LOCAL_SRC_FILES := lib/mylib_arm64.a
else
$(error platform not supported!)
endif
:app:externalNativeBuildCleanDebug
处失败,出现以下错误。
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:externalNativeBuildCleanDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.internal.UncheckedException: Build command failed.
Error while executing process /home/sourav/android/sdk/ndk/20.0.5594570/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/sourav/code/app/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/sourav/code/app/app/src/main/jni/Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/home/sourav/code/app/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/sourav/code/app/app/build/intermediates/ndkBuild/debug/lib clean}
/home/sourav/code/app/app/src/main/jni/mylib/Android.mk:12: *** platform not supported!. Stop.
/home/sourav/android/sdk/ndk/20.0.5594570/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/sourav/code/app/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/sourav/code/app/app/src/main/jni/Application.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/home/sourav/code/app/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/sourav/code/app/app/build/intermediates/ndkBuild/debug/lib clean}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
// For ndk-build, instead use the ndkBuild block.
ndkBuild {
// Sets optional flags for the C++ compiler.
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}
externalNativeBuild {
ndkBuild {
path file('src/main/jni/Android.mk')
}
}
}
最佳答案
以防万一有人偶然发现同样的问题,在尝试了一切(包括 Build > Clean Project)之后,通过删除根项目目录中的 .gradle 文件夹并再次构建来解决上述问题。
关于即使在正确设置 abiFilters 之后,Android Studio 也会忽略 ndk-build 的 APP_ABI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58288521/
我使用的是 android-ndk-r13b,我直接从 Android 网站下载它(不是从 SDK 管理器),并从 Android Studio 中的项目结构设置路径。 它能够检测到我的 Androi
我正在尝试运行 NDK 来编译 native 代码以在 Atom(x86) 处理器和 ARM 上运行。无论我如何设置 APP_ABI,NDK 都在生成 armeabi 库。即使我只为 APP_ABI
我想知道应该将哪些架构放入我的 Android 游戏的 Application.mk 文件中。 我想支持所有可以在 Google Play 和其他类型的 Android 商店上下载游戏的平台。 我会说
我正在开发一个 Android 应用程序,该应用程序具有使用 ndk-build 构建的 native 库依赖项.反过来,该库取决于我添加到根目录 Android.mk 中的预构建静态库 (.a)如下
我是一名优秀的程序员,十分优秀!