【发布时间】:2016-03-20 17:55:07
【问题描述】:
几个月前,我最初只用一个移动模块开始我的项目,现在我也有兴趣为可穿戴设备配置我的应用程序。也就是说,我的所有文件(Java、XML、drawable 等)都在移动模块中,所以我需要将我想要在移动模块和穿戴模块之间共享的所有文件转移到新创建的“通用”中模块?
编辑:
有人可以向我解释一下来自移动设备和 Wear 的 Gradle 文件的以下 Gradle 项目同步错误是什么意思:
...这发生在我在两个模块中包含 compile project(':common') 之后:
首先,这是我的通用模块:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "dpark.gameoflife"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
}
移动模块:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "dpark.gameoflife"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile project(':common')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
}
最后,我的穿戴模块:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "dpark.gameoflife"
minSdkVersion 20
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile project(':common')
}
...如果有的话,我在发布模式下签署了我的公共模块的 APK,但我得到了与上面所示相同的错误。
【问题讨论】:
-
这里对这些问题的处理很长:stackoverflow.com/questions/62694206/…
标签: android android-studio module wear-os