When configuring the debug environment: Error: FAILURE: Build failed with an exception, debugfailure

Source: Internet
Author: User

When configuring the debug environment: Error: FAILURE: Build failed with an exception, debugfailure
Error: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task': app: externalNativeBuildDebug '.> build command failed. error while executing process E: \ Android \ Sdk \ ndk-bundle \ ndk-build.cmd with arguments {NDK_PROJECT_PATH = null APP_BUILD_SCRIPT = G: \ project \ Android \ Anti-shake-arithmetic \ app \ src \ main \ jni \ Android. mk NDK_APPLICATION_MK = G: \ project \ Android \ Anti-shake-arithmetic \ app \ src \ main \ jni \ Application. mk APP_ABI = armeabi NDK_ALL_ABIS = armeabi NDK_DEBUG = 1 APP_PLATFORM = android-15 NDK_OUT = G: /project/Android/Anti-shake-arithmetic/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT = G: \ project \ Android \ Anti-shake-arithmetic \ app \ build \ intermediates \ ndkBuild \ debug \ lib G: /project/Android/Anti-shake-arithmetic/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/libNDKUtils. so} [armeabi] StaticLibrary: libclapack1.aprocess _ begin: CreateProcess (NULL, E:/Android/Sdk/ndk-bundle/build //.. /toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar crsD G: /project/Android/Anti-shake-arithmetic/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/libclapack1.a make: *** [G: /project/Android/Anti-shake-arithmetic/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/libclapack1.a] Error 206 * Try: run with -- stacktrace option to get the stack trace. run with -- info or -- debug option to get more log output. the above error occurs when I want to configure the debug environment in Android Studio in NDK Development (specific steps: http://www.cnblogs.com/xiaoxiaoqingyi/p/7143536.html), so I added the following nodes under the gradle configuration file:

ExternalNativeBuild {// use ndk-build ndkBuild {path 'src/main/jni/Android. mk '} // use the following configuration if cmake is used // cmake {// path 'src/main/jni/CMakeLists.txt '//}}

 

When these nodes are not added, I can compile and run the. so dynamic library. After these nodes are added, the above error occurs. First, I saw NDK_PROJECT_PATH = null. the so library is not well connected, so I have been google for a long time. There are probably the following solutions. You can try it one by one: 1. Modify sourceSets in gradle under module to specify the dynamic library path node, this node is used to configure the jni library path. In the Android Studio environment, the default jniLibs path is src/main/jniLibs. If you are porting from an old project, the directory may not exist. You can add the following configuration in the android node:
// Specify the dynamic library path sourceSets {main {jni. srcDirs = [] // disable automatic ndk-build call, which ignore our Android. mk jniLibs. srcDir 'src/main/libs '}}

 

2. There are also solutions to put the compiled dynamic library under the app/libs directory, because this directory stores the jar package by default, put the compiled dynamic library in the app/libs directory, and then add the following configuration to the android node:
sourceSets {        main {            jniLibs.srcDirs = ['libs‘]        }    }

 

3. If both of the above solutions do not solve your problem, it is likely that your Android. mk configuration problem. Does your Android. mk have a total Android. mk, and then include other Android. mk? If yes, you should reconfigure your sub-Android. mk. Like the OpenCV native library, it uses a general Android. mk and includes other sub-Android. mk. The OpenCV library is configuration-free and I have compiled it successfully. I got the first error because when I configured the levmar library, levmar used a third-party library (clapack), and the Sub-Android. mk was not configured. Finally, I went to the clapack library because the project did not use the clapack library. Finally, the compilation is successful. I have also said that my purpose is to debug C/C ++ code. After compilation is successful, the debug environment is actually configured, but the debug environment still cannot be used. That is to say, the Code in that line sets the breakpoint and runs there, but it still cannot be stopped. Debug detects the error only when the C/C ++ code reports an error. This problem has not been solved. It is very likely that I use a large number of third-party compiled dynamic libraries and directly use the source code, such as ffmpeg and opencv. References: https://stackoverflow.com/questions/21096819/jni-and-gradle-in-android-studio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.