Android的磨损应用程序打包失败,口味磨损、应用程序、口味、Android

2023-09-05 23:19:48 作者:待你长发及腰我便一刀咔嚓

我有,其中包括一个磨损的应用程序的应用程序。一切工作正常,在调试一个真正的设备测试。我可以ALSE创建一个包里面的磨损APK发布APK。但是,只有当只有一个味道上我的申请。

I have an application that includes a wear app. All works fine on debug tested with a real device. I can alse create the release apk that packs the wear apk inside it. But only if there is only one flavour on my application.

欲保持两个版本不同的applicationID的应用程序,但是尽管这种编译没有错误,在这种情况下,两个释放的apk(各味之一)并不cointain相应磨损的apk

I want to maintain two versions of the application with different applicationId, but although this compile without errors, in this case the two release apks (one of each flavour) don't cointain the corresponding wear apks.

这是移动应用程序build.gradle的相关部分:

This is the relevant part of the mobile app build.gradle:

    productFlavors {
    Trial {
        applicationId "com.example.myapp.trial"
        versionName "3.0.1"
        versionCode 301
    }
    Full {
        applicationId "com.example.myapp"
        versionName "3.0.1"
        versionCode 301
    }
}

}

dependencies {
    compile 'com.google.android.gms:play-services:6.1.+@aar'
    wearApp project(':myWearApp')
}

这是correspondig磨损应用build.gradle:

And this is the correspondig wear app build.gradle:

productFlavors {
    Trial {
        applicationId "com.example.myapp.trial"
        versionName "3.0.1"
        versionCode 301
    }
    Full {
        applicationId "com.example.myapp"
        versionName "3.0.1"
        versionCode 301
    }
}

}

dependencies {
    compile 'com.google.android.support:wearable:1.0.0'
    compile 'com.google.android.gms:play-services-wearable:6.1.71'
}

任何帮助将受到欢迎。谢谢。

Any help will be welcomed. Thanks.

推荐答案

由于线索斯科特给了我这个是完整的解决方案:

Thanks to the clue Scott gave me this is the full solution:

1)香料必须是小写

2)依赖关系配置必须包括味道的发布

2.) dependency configurations must include flavorRelease

3)。在磨损应用BUIL摇篮,在Android的{},我们必须包括 publishNonDefault真正

3.) In Wear app buil gradle, under android{}, we must include publishNonDefault true

因此​​,对于移动应用build.gradle:

So for mobile app build.gradle:

android {

......

productFlavors {
    trial {
        applicationId "com.sample.myapp.trial"
        versionName "3.0.1"
        versionCode 301
    }
    full {
        applicationId "com.sample.myapp"
        versionName "3.0.1"
        versionCode 301
    }
 }
}

dependencies {
    trialWearApp project(path: ':myWearApp', configuration: 'trialRelease')
    fullWearApp project(path: ':myWearApp', configuration: 'fullRelease')
}

和磨损应用build.gradle:

And for wear app build.gradle:

android {

  publishNonDefault true
......

productFlavors {
    trial {
        applicationId "com.sample.myapp.trial"
        versionName "3.0.1"
        versionCode 301
    }
    full {
        applicationId "com.sample.myapp"
        versionName "3.0.1"
        versionCode 301
    }
 }
}