Error:Execution failed for task ':app:compileDebugNdk'. > NDK not configured.

本文介绍了一种常见的Android开发中遇到的问题:在构建项目时出现的'compileDebugNdk'任务失败,提示NDK未配置。文章提供了具体的解决步骤,包括如何在build.gradle文件中设置jni.srcDirs为空列表来解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


报错信息:

Error:Execution failed for task ':app:compileDebugNdk'. > NDK not configured. Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties. (On Windows, make sure you escape backslashes, e.g. C:\\ndk r


解决方法:

         build.gradle文件中添加:

   sourceSets.main {
    jni.srcDirs = []
   }

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Launching lib\main.dart on V2279A in debug mode... Running Gradle task 'assembleDebug'... Your project is configured with Android NDK 26.3.11579264, but the following plugin(s) depend on a different Android NDK version: - call_log requires Android NDK 27.0.12077973 - device_info_plus requires Android NDK 27.0.12077973 - flutter_phone_direct_caller requires Android NDK 25.1.8937393 - fluttertoast requires Android NDK 27.0.12077973 - on_audio_query_android requires Android NDK 27.0.12077973 - permission_handler_android requires Android NDK 27.0.12077973 Fix this issue by using the highest Android NDK version (they are backward compatible). Add the following to D:\flutterDev\dialing_assistant\android\app\build.gradle.kts: android { ndkVersion = "27.0.12077973" ... } FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':on_audio_query_android:compileDebugKotlin'. > Error while evaluating property 'compilerOptions.jvmTarget' of task ':on_audio_query_android:compileDebugKotlin'. > Failed to calculate the value of property 'jvmTarget'. > Unknown Kotlin JVM target: 21 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 27s Error: Gradle task assembleDebug failed with exit code 1
最新发布
06-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值