我有.so文件和jar,但是当我运行它时,我得到错误:无法识别apk for variant arm-debug和device。我在这里是个菜鸟所以我一定做错了什么,但我似乎无法弄明白。有任何想法吗?我正在使用Android Studio 1.1.0和genymotion进行模拟。
这就是我的构建文件:
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')
}
答案 0 :(得分:9)
在defaultConfig上添加build.gradle上要构建的动作
ndk {
moduleName "yourlibraryname"
}
像这样
defaultConfig {
applicationId "com.ctech.music.androidstreamer"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
moduleName "yourlibraryname"
}
}
并在android {}检查结束时添加此内容
android {
...
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'mips'
universalApk true
}
}
}