如何在Android Studio中启用Neon来构建和调试本机代码(c)? [英] How to build and debug native code (c) with neon enabled in android studio?

查看:640
本文介绍了如何在Android Studio中启用Neon来构建和调试本机代码(c)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是 is-it-可能会在android工作室中调试cc吗?最后由Yuchen Zhong回答的问题,并做了一些基本的例子,我也能够构建和调试.

I am referring is-it-possible-to-debug-c-c-in-android-studio? last answer by Yuchen Zhong and did some basic example also, that I am able to build and debug also.

所以现在我正在尝试使用旧的应用程序项目来做同样的事情.我的旧应用buil.gradle是

So now I am trying with my old app project to do same thing. My old app buil.gradle is

apply plugin: 'com.android.application'
android {
    compileSdkVersion 18
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "pku......"
        minSdkVersion 9
        targetSdkVersion 17

        sourceSets.main {
            jni.srcDirs = []
            jniLibs.srcDir 'C:/Users/Admin/AndroidStudioProjects/and..../app/src/main/libs'
        }

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            ndk {
               debuggable = true
            }
        }
        debug {
              debuggable = true
              jniDebuggable = true
        }
        debug {
            jniDebuggable true
        }
    }
}

更新后的build.gradle紧随其后,因此我将能够通过android studio调试代码.

Updated build.gradle is follow so I will able to debug my code through android studio.

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 23
        buildToolsVersion  = "23.0.1"

        defaultConfig.with {
            applicationId = "pku........"
            minSdkVersion.apiLevel = 18
            targetSdkVersion.apiLevel = 23
            versionCode = 1
            versionName = "1.0"
            //sourceSets.main {
            //    jni.srcDirs = []
            //    jniLibs.srcDir 'C:/Users/Admin/AndroidStudioProjects/andh...../app/src/main/libs'
            //}
        }
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file('proguard-android.txt'))
        }
    }

   android.ndk {

        abiFilters.add("armeabi-v7a")
        moduleName = "icandroid"
        //CFlags.add("-std=c99")
        //CFlags.add("-mfloat-abi=soft")
        //CFlags.add("-mfpu=neon")
        CFlags.addAll(["-std=c99 ", "-mfloat-abi=softfp", "-mfpu=neon", "-O3", "-DCARES_STATICLIB", "-Wno-c++11-long-long"])
        stl = "stlport_shared" // stlport_shared, gnustl_static, "system"

    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

但是在构建时出现错误

prebuilt \ windows-x86_64 \ lib \ gcc \ arm-linux-androideabi \ 4.9 \ include \ arm_neon.h 错误:(31,2)错误:#error您必须启用NEON指令(例如 -mfloat-abi = softfp -mfpu = neon)以使用arm_neon.h

prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9\include\arm_neon.h Error:(31, 2) error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h

我不知道如何解决此问题,因为我也提到了cflag.

I don't know how to solve this problem because I have mentioned cflag also.

请帮助我解决此错误,如果还有其他错误,请更正我.

Please help me to solve this error and if there are some more error then also correct me.

推荐答案

您的Application.mk文件是什么样的?添加

What does your Application.mk file look like? Adding

APP_CFLAGS := -mfloat-abi=softfp -mfpu=neon到Application.mk应该可以修复该错误.

APP_CFLAGS := -mfloat-abi=softfp -mfpu=neon to Application.mk should fix the error.

这篇关于如何在Android Studio中启用Neon来构建和调试本机代码(c)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆