未随build一起安装的库使Android Studio可以使用CMAKE-GUI

时间:2018-11-23 14:49:40

标签: android-studio gradle cmake build.gradle android-build

系统信息:

  

Android Studio 3.2.1
  Linux Ubuntu 16.04

简介


我最近遇到了我的IDE(Android Studio)问题。我用它与Gradle和CMakeLists一起开发Native / Java应用程序。

我使用一些CMakeList导出C / C ++中的某些函数以用于我的应用程序。

因此,这些Cmakelists将创建一些可以使用的库。

问题


当我“制作”我的项目时,它会成功构建,但是无论修改还是不修改,库都不会改变。

在那之后,我认为我可能需要先“清理我的项目”,但没事。

您可以在帖子下看到我的build.gradle。

尝试过的解决方案


我发现的解决方法是使用CMAKE-GUI编译每个库,然后编译我的Android项目以查看先前所做的修改。

那是不好的,不是正常的。

帮助


我想知道为什么我的项目不再制作我的库并将其“安装”到适当的文件夹中。

不必显示我的CMakeList,因为它可以在装有Linux的CLion和装有Visual Studio的Windows上使用。

Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.media.[NAME_OF_MY_PROJET]"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk { abiFilters "armeabi-v7a" }
        externalNativeBuild {
            cmake {
                cppFlags "-O3  -fno-stack-protector -fintegrated-as "

                arguments "-DANDROID_ABI=armeabi-v7a", "-DANDROID_TOOLCHAIN=clang",
                        "-DANDROID_NATIVE_API_LEVEL=24", "-DANDROID_NDK=/Android/Sdk/ndk-bundle",
                        "-DANDROID_STL=c++_static", "-DANDROID_SDK_ROOT=/Android/Sdk/"
            }
        }
    }
    buildTypes {
          /*  customDebugType {
                debuggable true
            } */
            debug {
                jniDebuggable true
            }
       /* release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }*/
    }
    externalNativeBuild {
        cmake {
            path "../CMakeLists.txt"
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
}

0 个答案:

没有答案