在Android studio中更改cmake目录
我从某人那里复制了一个Android studio项目,我无法清理和重建该项目。这是下面弹出的错误 错误:任务“:app:externalNativeBuildCleanDebug”的执行失败 启动进程“command”C:\Users\Lenovo\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe“”时出现问题 假设Users\Lenovo是以前的程序员用户名,而不是我的pc用户名 这是我的build.gradle for应用程序 应用插件:“com.android.application”在Android studio中更改cmake目录,android,cmake,Android,Cmake,我从某人那里复制了一个Android studio项目,我无法清理和重建该项目。这是下面弹出的错误 错误:任务“:app:externalNativeBuildCleanDebug”的执行失败 启动进程“command”C:\Users\Lenovo\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe“”时出现问题 假设Users\Lenovo是以前的程序员用户名,而不是我的pc用户名 这是我的build.gradle for应用程
android {
compileSdkVersion 26
defaultConfig {
applicationId "linkdood.isenseocr_android"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
buildTypes {
release {
useProguard true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.rmtheis:tess-two:8.0.0'
implementation project(':openCVLibrary331')
implementation project(':isenselib')
}
有没有办法解决这个问题 只需在build.gradle中的ndk下注释
abiFilters
行,现在进行同步、清理和重建,现在将更改路径,您现在可以重新引入abiFilters
并重新构建。这解决了我的问题。我知道现在回答这个问题已经太迟了,但它会帮助别人。
您确实删除了外部NualNaveBug {Case{PATH’CMAKLISTIST.TXT’} -但是,由于这个原因,您将不能使用C++文件…
要更改路径,请执行以下操作:
删除:
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
…来自应用程序构建gradle
- 选择“链接C++项目Gradle”
- 您将看到一个对话框
- 在此处输入cmakelist的路径,然后单击“确定”
- 重建项目
- 如果它仍然无法工作,那么请使缓存无效并重新启动android studio
.cxx
),请在示例中找到正确的解决方案!!请参阅和详细信息。嗨!谢谢你的回复。抱歉没有更新。我的代码在删除externalNativeBuild{cmake{path'CMakeLists.txt'}}后仍然可以工作,感谢您提供的信息!!