i-p-tel / sipdroid

Free SIP/VoIP client for Android
http://sipdroid.org
GNU General Public License v3.0
633 stars 263 forks source link

Android Studio NDK integration gradle config for SIPdroid #1012

Closed omatt closed 8 years ago

omatt commented 8 years ago

I have successfully compiled and launch it on the device before, but the settings for audio codec is not working properly. I found out that I have not successfully integrated the jni to the project and I'm currently having some difficulties integrating jni to the sipdroid project.

I'm currently following this guide http://tools.android.com/tech-docs/new-build-system/gradle-experimental, and testing the sample projects from here https://github.com/googlesamples/android-ndk. Samples from google successfully run without any problems, but when I'm trying to migrate the config of the sipdroid project for the integration as specified in the guide; I encounter errors.

Using Android Studio 2.0 preview 4 with gradle 'com.android.tools.build:gradle-experimental:0.4.0'

omatt commented 8 years ago

My current build.gradle config

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

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

        defaultConfig.with {
            applicationId = "com.test.sipdroid"
            minSdkVersion = 15
            targetSdkVersion = 23
            versionCode = 1
            versionName = "1.0"
        }
    }

    compileOptions.with {
        sourceCompatibility=JavaVersion.VERSION_1_7
        targetCompatibility=JavaVersion.VERSION_1_7
    }

    /*
     * native build settings
     */
    android.ndk {
        moduleName = "SIPdroid"
        /*
         * Other ndk flags configurable here are
         * cppFlags.add("-fno-rtti")
         * cppFlags.add("-fno-exceptions")
         * ldLibs.addAll(["android", "log"])
         * stl       = "system"
         */
    }

    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file('proguard-rules.txt'))
        }
    }

    android.productFlavors {
        // for detailed abiFilter descriptions, refer to "Supported ABIs" @
        // https://developer.android.com/ndk/guides/abis.html#sa
        create("arm") {
            ndk.abiFilters.add("armeabi")
        }
        create("arm7") {
            ndk.abiFilters.add("armeabi-v7a")
        }
        create("arm8") {
            ndk.abiFilters.add("arm64-v8a")
        }
        create("x86") {
            ndk.abiFilters.add("x86")
        }
        create("x86-64") {
            ndk.abiFilters.add("x86_64")
        }
        create("mips") {
            ndk.abiFilters.add("mips")
        }
        create("mips-64") {
            ndk.abiFilters.add("mips64")
        }
        // To include all cpu architectures, leaves abiFilters empty
        create("all")
    }
}

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'
}
omatt commented 8 years ago

I finally fixed this issue http://stackoverflow.com/questions/34627394/sipdroid-android-studio-ndk-integration-error/

aries255 commented 4 years ago

Hello Sir. Im having trouble how to import it on android studio. Can you please help me.