[英]Change cmake directory in Android studio
I had copy an Android studio project from someone and i am unable to clean and rebuild the project.我从某人那里复制了一个 Android Studio 项目,但我无法清理和重建该项目。 This is the following error pop out.这是以下错误弹出。
Error:Execution failed for task ':app:externalNativeBuildCleanDebug'.错误:任务“:app:externalNativeBuildCleanDebug”的执行失败。
A problem occurred starting process 'command 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\cmake\\3.6.4111459\\bin\\cmake.exe''启动进程'command 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\cmake\\3.6.4111459\\bin\\cmake.exe''出现问题
Suppose the Users\\Lenovo is the previous programmer user name where it is not my pc user name.假设 Users\\Lenovo 是以前的程序员用户名,而不是我的 pc 用户名。
This is my build.gradle for app这是我的 build.gradle 应用程序
apply plugin: 'com.android.application'应用插件:'com.android.application'
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')
}
Is there anyway to solve this problem?有没有办法解决这个问题?
Just comment abiFilters
line under ndk in build.gradle and now sync,clean and rebuild,now the path will be changed, you can now reintroduce abiFilters
and build again.只需在 build.gradle 中的 ndk 下注释abiFilters
行,然后同步、清理和重建,现在路径将更改,您现在可以重新引入abiFilters
并再次构建。 This solved my problem.这解决了我的问题。
I know it's too late to answer this question but it will help others.我知道现在回答这个问题为时已晚,但它会帮助其他人。 You did remove externalNativeBuild { cmake { path 'CMakeLists.txt' } } - but because of this you wont be able to use c++ file then... for changing path do it like this:您确实删除了 externalNativeBuild { cmake { path 'CMakeLists.txt' } } - 但正因为如此,您将无法使用 c++ 文件,然后...更改路径这样做:
Remove:移除:
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
..from app build gradle ..从应用程序构建gradle
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.