gpt4 book ai didi

gradle - 将Android Wear1应用与android gradle插件3.0.1捆绑在一起的问题

转载 作者:行者123 更新时间:2023-12-03 03:18:54 25 4
gpt4 key购买 nike

由于使用最新的Android Gradle插件3.0.1,我无法将Wear1签名的APK放入签名的移动apk文件的res / raw文件夹中

我必须使用最新的gradle来获取某些依赖项的Google存储库。

我已经检查了磨损apk,并用我的生产签名进行了签名。

我知道 future 的首选方法是取消 bundle ,并且我可以成功做到这一点,但是Google在安装Wear 1应用程序方面的公认延迟问题使这种方式在目前没有吸引力。

以下是我的gradle文件。

项目build.config

buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

移动build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')


android {
compileSdkVersion 27
buildToolsVersion '27.0.2'

defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}

release {
signingConfig signingConfigs.release
}
}

flavorDimensions "environment"

productFlavors {

development {
dimension "environment"
}

production {
dimension "environment"
}
}
}

configurations {
developmentReleaseWearApp
productionReleaseWearApp
}

dependencies {
implementation 'com.google.android.gms:play-services-wearable:11.8.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:percent:27.1.0'

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

developmentReleaseWearApp project(path: ':wear', configuration: 'wear1Release')
productionReleaseWearApp project(path: ':wear', configuration: 'wear1Release')

implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:preference-v14:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
provided 'com.google.android.wearable:wearable:2.2.0'
implementation 'com.google.android.support:wearable:2.2.0'
}

穿build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')

android {
compileSdkVersion 27
buildToolsVersion '27.0.2'

publishNonDefault true

defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 23
targetSdkVersion 27
versionCode 2
versionName "1.0"
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}

release {
signingConfig signingConfigs.release
}
}

flavorDimensions "wearVersion"

productFlavors {
wear1 {
dimension "wearVersion"
// Use the defaultConfig value
}
wear2 {
dimension "wearVersion"
minSdkVersion 24
}
}

configurations {
wear1Release
wear2Release
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.google.android.gms:play-services-wearable:11.8.0"
implementation "com.android.support:support-compat:27.1.0"
implementation "com.android.support:support-annotations:27.1.0"
implementation "com.android.support:appcompat-v7:27.1.0"
implementation "com.android.support:recyclerview-v7:27.1.0"
implementation "com.android.support:percent:27.1.0"
implementation "com.android.support:support-v4:27.1.0"
implementation "com.android.support:wear:27.1.0"
implementation "com.google.android.support:wearable:2.2.0"
implementation "com.android.support.constraint:constraint-layout:1.1.0-beta5"
provided 'com.google.android.wearable:wearable:2.2.0'

}

settings.gradle
include ':mobile'
include ':wear'

gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

最佳答案

这周我遇到了同样的问题。今天,我终于设法使用3.0.1 gradle将Wear应用正确地嵌入了移动应用APK中。我在wear app build.gradle中添加了productFlavor,以匹配为其生成构建版本的移动应用程序的productFlavor。尝试在移动应用程序的build.gradle依赖关系列表中指定一个不同名称的Wear应用程序配置似乎是我的问题。

我建议尝试为您的磨损应用程序build.gradle添加开发和生产 flavor :

development {
dimension "wearVersion"
// Use the defaultConfig value
}

production {
dimension "wearVersion"
// Use the defaultConfig value
}

然后将您的移动应用程序build.gradle依赖项更改为:
wearApp project(path: ':wear')

生成构建时,默认情况下它应将productFlavor与productFlavor匹配,这对我有用。

关于gradle - 将Android Wear1应用与android gradle插件3.0.1捆绑在一起的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49049067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com