gradle build在Android Studio中的c库上失败

时间:2015-05-26 20:38:18

标签: android git android-studio gradle android-ndk

首先让我说我是Gradle,Android Studio和Git的新手。我们刚刚从Eclipse和SVN迁移到这些技术,并且在运行我们的Android项目时遇到了一些麻烦。我们正在开发Mac。我从另一个团队继承了这个项目,并且不确定他们为什么选择做某些事情。 [不幸的是,我必须在整个屏幕截图中审查项目名称和用户。]

我们正在使用c ogg库在我们的Android应用程序中录制音频文件。

我们收到的错误是: enter image description here

我们发现this blog postthis stackoverflow question链接到this other SO question,但我们无法让其中任何一个工作。

我们不确定该项目是否设置正确,因为似乎有很多Android.mk文件浮出水面。

android make files more android make files

从上面的问题链接看来,似乎我们需要强制Gradle不要用它自己覆盖我们的Android.mk文件,但这些建议似乎只能让我们进一步深入兔子洞。

有人会指出我们正确的方向吗?

JNI / Android.mk

LOCAL_PATH := $(call my-dir)

LOCAL_C_INCLUDE := $(LOCAL_PATH)/include

include $(addprefix $(LOCAL_PATH)/, $(addsuffix /Android.mk, \
    libogg \
    libvorbis \
    libvorbis-jni \
))

JNI / libogg / Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libogg
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
ifeq ($(TARGET_ARCH),arm)
    LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
endif


LOCAL_SRC_FILES := \
    bitwise.c \
    framing.c

include $(BUILD_SHARED_LIBRARY)

JNI / libvorbis-JNI / Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := vorbis-jni
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -fsigned-char
ifeq ($(TARGET_ARCH),arm)
    LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
endif

LOCAL_SHARED_LIBRARIES := libogg libvorbis

LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

LOCAL_SRC_FILES := \
    com_*****_android_audio_VorbisEncoder.c

include $(BUILD_SHARED_LIBRARY)

JNI / libvorbis / Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libvorbis
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
ifeq ($(TARGET_ARCH),arm)
    LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
endif
LOCAL_SHARED_LIBRARIES := libogg

LOCAL_SRC_FILES := \
    mdct.c      \
    smallft.c   \
    block.c     \
    envelope.c  \
    window.c    \
    lsp.c       \
    lpc.c       \
    analysis.c  \
    synthesis.c \
    psy.c       \
    info.c      \
    floor1.c    \
    floor0.c    \
    res0.c      \
    mapping0.c  \
    registry.c  \
    codebook.c  \
    sharedbook.c    \
    lookup.c    \
    bitrate.c   \
    vorbisfile.c    \
    vorbisenc.c

include $(BUILD_SHARED_LIBRARY)

项目的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

项目模块的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.*****.android.hud"
        minSdkVersion 14
        targetSdkVersion 18
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

0 个答案:

没有答案