文章目录
一、 报错信息
二、 问题分析
三、 解决方案
一、 报错信息
报错信息 :
Executing tasks: [:app:assembleDebug] in project D:\002_Project\xxx Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. > Task :app:preBuild UP-TO-DATE > Task :app:preDebugBuild UP-TO-DATE > Task :app:compileDebugAidl NO-SOURCE > Task :app:compileDebugRenderscript NO-SOURCE > Task :app:generateDebugBuildConfig > Task :app:checkDebugAarMetadata > Task :app:generateDebugResValues > Task :app:generateDebugResources Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. > Task :app:createDebugCompatibleScreenManifests > Task :app:extractDeepLinksDebug > Task :app:processDebugMainManifest [com.android.support:animated-vector-drawable:28.0.0] C:\Users\octop\.gradle\caches\transforms-2\files-2.1\06be3ac5cf1549324533186b1b8df594\animated-vector-drawable-28.0.0\AndroidManifest.xml Warning: Package name 'android.support.graphics.drawable' used in: com.android.support:animated-vector-drawable:28.0.0, com.android.support:support-vector-drawable:28.0.0. > Task :app:processDebugManifest > Task :app:mergeDebugResources > Task :app:generateJsonModelDebug FAILED Could not get version from cmake.dir path 'xxx\cmake\3.6.4111459'. Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. > Task :app:javaPreCompileDebug > Task :app:processDebugManifestForPackage FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:generateJsonModelDebug'. > xxx\CMakeLists.txt : C/C++ debug|arm64-v8a : Could not get version from cmake.dir path 'xxx\Sdk\cmake\3.6.4111459'. * 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 40s 11 actionable tasks: 11 executed
二、 问题分析
CMake , NDK 相关错误 , 先去查看 SDK , NDK , JRE 版本 ;
点击 菜单栏 / File / Project Structure 选项 , 查看弹出的对话框 ,
发现 NDK 选项为空 , 该选项只能通过工程下的 local.properties 配置文件进行配置 ;
查看 local.properties 配置文件 , 这里单独配置了一个 CMake 路径 ;
三、 解决方案
删除 local.properties 配置文件中的除 SDK 之外的其它路径 , 不需要手动配置 NDK 路径 , 配置了 SDK 路径后 , 编译时 , 会自动生成 NDK 的路径 ;