Android Studio 1.5.1、Gradle 2.8、w/mobile&;穿免费/付费的衣服
我不知所措。使用AS 1.5.1和Gradle 2.8,我有移动和磨损模块。当我选择mobile和wear的调试版本时,我知道我必须手动编译/运行每个版本,才能在各自的设备上运行。这样做没有问题:调试/运行应用程序/等等 但是,对于mobile和wear flavors的发布,当我还没有在我的mobile/wear build.gradle文件中创建signingConfigs部分时,AS会提示我这样做,并在对话框底部有“修复”按钮。我首先使用我的磨损模块添加keyAlias、keyPassword、storeFile和storePassword。通过这个相同的对话框,我选择了一个也是唯一一个拥有signingConfig的buildType版本。当我在该对话框上单击Ok时,上一个对话框的底部有“修复”按钮,该按钮以前是“仍然存在渐变错误”。我使用mobilegradle文件执行相同的步骤,它在对话框中也指出仍然存在gradle错误。磨损版本的生成/运行结果不会创建android_wear_micro_apk.apk以将其包含在移动构建中。当移动模块建成时,它没有任何磨损apk。我的整个应用程序(mobile/wear)最初是一组Eclipse项目(在Play store中工作,实际上是在Play store中),我已经手工合并到了其中 我尝试创建一个全新的项目,包括移动和穿戴。当我开始运行发布版时,它也促使我创建签名概念。然而,android_wear_micro_apk.apk是在磨损编译过程中创建的。此外,移动应用程序还包含wear的apk。mobile debug和release APK大小不同,release APK更大。我知道“android_wear_micro_apk.apk”文件的唯一方法是因为这个新的/精简的测试项目——否则,我的原始文件就没有胶水了 这是手机版本。gradleAndroid Studio 1.5.1、Gradle 2.8、w/mobile&;穿免费/付费的衣服,android,gradle,wear-os,android-flavors,Android,Gradle,Wear Os,Android Flavors,我不知所措。使用AS 1.5.1和Gradle 2.8,我有移动和磨损模块。当我选择mobile和wear的调试版本时,我知道我必须手动编译/运行每个版本,才能在各自的设备上运行。这样做没有问题:调试/运行应用程序/等等 但是,对于mobile和wear flavors的发布,当我还没有在我的mobile/wear build.gradle文件中创建signingConfigs部分时,AS会提示我这样做,并在对话框底部有“修复”按钮。我首先使用我的磨损模块添加keyAlias、keyPasswo
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
signingConfigs {
the_pro_mobile_config {
keyAlias 'MY_ALIAS_PRO'
keyPassword 'MY_PASSWORD_PRO'
storeFile file('my_keystore_pro.keystore')
storePassword 'MY_STORE_PASSWORD_PRO'
}
the_free_mobile_config {
keyAlias 'MY_ALIAS_FREE'
keyPassword 'MY_PASSWORD_FREE'
storeFile file('my_keystore_free.keystore')
storePassword 'MY_STORE_PASSWORD_FREE'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES/httpcore-4.0.jar'
exclude 'META-INF/DEPENDENCIES/httpclient-4.3.6.jar'
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 25
versionName "2.0.0"
multiDexEnabled = true
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
free {
applicationId "com.my_app.thefree"
signingConfig signingConfigs.the_free_mobile_config
}
pro {
applicationId "com.my_app.thepro"
signingConfig signingConfigs.the_pro_mobile_config
}
}
}
dependencies {
wearApp project(':wear')
compile project(':my_license_module')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'commons-io:commons-io:2.4'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
signingConfigs {
the_wearable_config {
keyAlias 'MY_ALIAS'
keyPassword 'MY_KEYPASSWORD'
storeFile file('my_keystore_wearable.keystore')
storePassword 'MY_STORE_PASSWORD'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 25
versionName "2.0.0"
multiDexEnabled = true
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
zipAlignEnabled true
signingConfig signingConfigs.the_wearable_config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
free {
applicationId "com.myapp.my_free_app"
}
pro {
applicationId "com.myapp.my_pro_app"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
}
这是你的衣服,格雷德尔
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
signingConfigs {
the_pro_mobile_config {
keyAlias 'MY_ALIAS_PRO'
keyPassword 'MY_PASSWORD_PRO'
storeFile file('my_keystore_pro.keystore')
storePassword 'MY_STORE_PASSWORD_PRO'
}
the_free_mobile_config {
keyAlias 'MY_ALIAS_FREE'
keyPassword 'MY_PASSWORD_FREE'
storeFile file('my_keystore_free.keystore')
storePassword 'MY_STORE_PASSWORD_FREE'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES/httpcore-4.0.jar'
exclude 'META-INF/DEPENDENCIES/httpclient-4.3.6.jar'
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 25
versionName "2.0.0"
multiDexEnabled = true
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
free {
applicationId "com.my_app.thefree"
signingConfig signingConfigs.the_free_mobile_config
}
pro {
applicationId "com.my_app.thepro"
signingConfig signingConfigs.the_pro_mobile_config
}
}
}
dependencies {
wearApp project(':wear')
compile project(':my_license_module')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'commons-io:commons-io:2.4'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
signingConfigs {
the_wearable_config {
keyAlias 'MY_ALIAS'
keyPassword 'MY_KEYPASSWORD'
storeFile file('my_keystore_wearable.keystore')
storePassword 'MY_STORE_PASSWORD'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 25
versionName "2.0.0"
multiDexEnabled = true
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
zipAlignEnabled true
signingConfig signingConfigs.the_wearable_config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
free {
applicationId "com.myapp.my_free_app"
}
pro {
applicationId "com.myapp.my_pro_app"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
}
我解决了这个问题。还有其他关于这个问题的帖子,这就是我发现它们的地方 第一个加载项磨损梯度文件,添加
publishNonDefault true
在文件的“android{”部分
更改的主要部分是针对mobile gradle文件
第二,删除“wearApp项目(':wear')”并替换为这两个项目
freeWearApp project(path:':wear', configuration: 'freeRelease')
proWearApp project(path:':wear', configuration: 'proRelease')
我正在创建android_wear_micro_apk并将其添加到移动apk中
我的下一个任务是弄清楚为什么它不会自动安装以观看。同样,在执行Eclipse/等时,所有这些都起到了作用。您是否使用两个不同的密钥来签署您的wear和您的移动应用程序?我在您的构建文件中看到这两个密钥库是不同的…刚刚将两个SigningConfig从mobile添加到wear的gradle和sam中e问题。请用您最新的更改更新您的原始帖子。请参阅下面我自己的答案。确保您的密钥相同。此外,在尝试此操作之前,请从穿戴设备中删除旧的/不同风格的应用程序。到目前为止,运气不好。即使对移动和穿戴使用相同的密钥库,也要加倍检查穿戴应用程序是否未安装,然后重新启动穿戴设备(LG G watch)。呃!FWIW:执行移动和磨损调试变体,磨损应用程序与移动应用程序进行通信。