Debugging C++/native library modules not working with Android Studio (Cmake used)

前端 未结 3 1213
刺人心
刺人心 2021-02-06 04:07

I\'m having trouble debugging C++ files of my library module.

Is this possible in general?

The debugging works fine if the application project contains the c++ c

3条回答
  •  广开言路
    2021-02-06 04:44

    The reason seems to be, that a release version of the lib is created, which does not support debugging, even if the app is built with debug options.

    Solution:

    To solve this issue, do the following workaround. It ensures that a debug version is built.


    In your apps build.gradle change:

    compile project(':nativelib')
    

    to

    compile project(path: ':nativelib' , configuration: 'debug')
    

    In the libs build.gradle add:

    android {
    
        publishNonDefault  true //this line
    
        compileSdkVersion 24
        buildToolsVersion "25.0.2"
        defaultConfig {
        ...
        }
    ...
    }    
    

    Updates:

    See the google issue for updates:

    https://code.google.com/p/android/issues/detail?id=222276

提交回复
热议问题