我想使用Gradle为4种不同的Android CPU处理器架构(armeabi armeabi-v7a x86 mips)构建4个独立的apks.
我在libs文件夹中为4个CPU架构构建了本机OpenCV库.
libs
-armeabi
-armeabi-v7a
-x86
-mips
Run Code Online (Sandbox Code Playgroud)
我想每个apk只包含对应正确CPU架构的OpenCV库.
当前的构建脚本如下:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':workspace:OpenCV4Android:sdk:java')
}
android {
compileSdkVersion 11
buildToolsVersion "18.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
flavorGroups "abi", "version"
productFlavors {
x86 {
flavorGroup "abi"
} …Run Code Online (Sandbox Code Playgroud) 我想基于当前的buildType在Android Gradle项目中动态添加依赖项.我知道我可以在依赖项中指定buildType:
compile project(path: ':lib1', configuration: 'debug')
Run Code Online (Sandbox Code Playgroud)
但是,如何使用当前的buildType来指定要导入的库的哪个变体,以便调试版本或发布版本自动导入库的调试版本或发行版本?我想要的是这样的(其中currentBuildType是一个包含当前使用的buildType名称的变量):
compile project(path: ':lib1', configuration: currentBuildType)
Run Code Online (Sandbox Code Playgroud)
我要导入的库项目已设置publishNonDefault true,因此将发布所有buildType.
我正在制作我的第一个Android服装应用程序,但我无法让Android Studio工作.首先我得到了错误
"Project with path ':wear' could not be found in project ':mobile'.
Run Code Online (Sandbox Code Playgroud)
这是通过添加"include ':wear"来解决的settings.gradle.
但随后出现了一个新错误:
"Error:Module version Test2:mobile:unspecified, configuration 'wearApp' declares a dependency on configuration 'default' which is not declared in the module descriptor for Test2:wear:unspecified" .
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个错误?
以防万一需要:这里是build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.verbraeken.joost.test2"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
} …Run Code Online (Sandbox Code Playgroud)