我是android dev的新手。我用外部本机lib(openCV)创建了一个应用程序,我试图将构建变体从debug更改为release。它适用于本机lib(我可以选择从调试到发布,似乎没问题)。但是,我无法将应用程序从调试版传递到另一版本:在构建版本中,如果我检查发布模式,它会自动切换回调试版。
有什么建议吗?
编辑:build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'key0'
keyPassword '-----'
storeFile file('----')
storePassword '----'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "-----"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions"
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'mips64'
/* arguments "-DANDROID_STL=c++_static" */
}
}
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':openCVLibrary320')
}
注意:我用----
替换了一些机密值