Search code examples
androidbuild.gradlendk-build

Android Unable to identify the apk for variant arm-debug and device


I have the .so files and the jar, but when I run it I get the error: Unable to identify the apk for variant arm-debug and device. I'm a noob here so I must be doing something wrong, but I cant seem to figure it out. Any ideas? I am using Android Studio 1.1.0 and genymotion for my emulation.

This is what my build file looks like:

apply plugin: 'com.android.application'

android {

    compileSdkVersion 22
    buildToolsVersion "22.0.0"
    defaultConfig {
        applicationId "com.ctech.music.androidstreamer"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        x86 {
            ndk {
                abiFilter "x86"
            }
        }
        arm {
            ndk {
                abiFilters "armeabi-v7a", "armeabi"
            }
        }
        mips {
            ndk {
                abiFilter "mips"
            }
        }

    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'
    compile files('libs/fmmr.jar')
}

Solution

  • Add on your build.gradle on defaultConfig the action to build

    ndk {
            moduleName "yourlibraryname"
           }
    

    like this

    defaultConfig {
            applicationId "com.ctech.music.androidstreamer"
            minSdkVersion 14
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
    
            ndk {
            moduleName "yourlibraryname"
           }
    
        }
    

    and add this at the end of android {} check for your architectures

    android {
      ...
      splits {
        abi {
          enable true
          reset()
          include 'x86', 'armeabi-v7a', 'mips'
          universalApk true
        }
      }
    }