2

I had copy an Android studio project from someone and i am unable to clean and rebuild the project. This is the following error pop out.

Error:Execution failed for task ':app:externalNativeBuildCleanDebug'.

A problem occurred starting process '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.

This is my build.gradle for app

apply plugin: '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?

iradarask
  • 21
  • 1
  • 3
  • can you please post the content of build.gradle file – kgandroid Apr 02 '18 at 10:33
  • which build.gradle file? project, app, opencv, library. This android studio file is to generate aar file. – iradarask Apr 02 '18 at 12:24
  • To change build directory (recently named `.cxx`), found correct solution in [another thread](https://stackoverflow.com/a/60492487/8740349) with example!! see [CMake docs](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/Cmake) and details. – Top-Master May 30 '21 at 03:35

2 Answers2

1

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. This solved my problem.

Vaishakh
  • 1,126
  • 10
  • 10
  • Hi! thanks for replying. sorry for not updating. My code work after i remove externalNativeBuild { cmake { path 'CMakeLists.txt' } } still, thanks for the information!! – iradarask Jun 18 '18 at 09:27
0

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:

Remove:

 externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
}

..from app build gradle

  • Right-click on the app module, select "Link C++ Project with Gradle" from the menu
  • You will see a dialog
  • Enter path of your cmakelist there and click ok
  • Rebuild the project
  • If it still doesn't work then invalidate the cache and restart android studio
Dominik
  • 1,366
  • 2
  • 18
  • 37
Phadu
  • 1