您的位置:首页 > 编程语言 > C语言/C++

Android Studio Linking an external C++ project 时候 报Invalid file name. Expected: CMakeLists.txt

2016-10-28 11:53 459 查看
Android Studio 右键Linking an external C++ project 时候

报Invalid file name. Expected: CMakeLists.txt错误

查看Android Studio 源码:

@Nullable
private String validateProjectFilePath(@NotNull File file) {
if (!file.exists()) {
return "The selected file does not exist";
}
if (myBuildSystemCombo.getSelectedItem() == BuildSystem.CMAKE && !file.getName().equals("CMakeLists.txt")) {
return "Invalid file name. Expected: CMakeLists.txt";
}
else if (myBuildSystemCombo.getSelectedItem() == BuildSystem.NDK_BUILD && !FileUtilRt.extensionEquals(file.getPath(), "mk")) {
return "Invalid file extension. Expected: .mk";
}
return null;
}


发现是选择条目必须是BuildSystem.CMAKE,也就是必须选择路径,如果直接复制粘贴的路径,就会提示错误。

解决方案:

一步步选择CmakeLists.txt路径即可,不要直接粘贴CmakeLists.txt的路径就不会出现这个错误.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐