我试图安装相同的应用程序,但使用不同的版本/变体。所以我找到了这个博客。 https://blog.grandcentrix.net/how-to-install-different-app-variants-on-one-android-device/ 我想做一些同样用博客与不同的冲刺不同的应用程序的图片 这是我的gradle这个文件:为Gradle传递的参数为null android
在Gitbash我”:
apply plugin: 'com.android.application'
def debugsuffix = System.getProperty('debugsuffix', project.getProperties().get('debugsuffix', null))
def final appId = 'com.arthlimchiu.testapp'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId = appId
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
dev {
applicationId = appId + "." + debugsuffix + ".dev"
resValue "string", "app_name", ".dev-" + debugsuffix
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
运行此命令后m在windows btw上, debugsuffix为NULL。
下面是我试图通过显示debugsuffix作为应用程序名称进行调试时的屏幕截图。
我在做命令吗?或者我错过了什么?这是我第一次用传递参数来做这种类型的gradle。有没有人试过这个?这真的是一个很好的帮助球员:)
你在哪里传递参数?你得到构建错误?如果是,那么错误是什么? –
为什么在Windows有gradlew.bat时使用MinGW? –
看看我的gitbash的截图,debugsuffix是参数,我通过“bug44”作为它的参数。 虽然我不会收到构建错误,但这就是为什么我通过使用“debugsuffix”变量命名我的应用程序来调试它,因为您可以看到它是“.dev-null”。零部分是调试后缀。我不知道为什么它是空的。 –