【发布时间】:2018-12-21 19:40:18
【问题描述】:
我目前正在尝试对 Wear OS 表盘进行编程。我首先编译了带有表盘的应用程序,但无法将其安装在我的 Android 智能手机(Android 6.0)上。所以我创建了一个额外的移动模块并将现有的穿戴模块添加为一个 Android 库。移动模块包含一个空白活动。现在我仍然无法在我的智能手机上安装该应用程序,当我想使用 AVD 测试该应用程序时,它显示“缺少功能:观看”
这是整个项目的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是移动模块的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "de.leinequell.nixiesmart"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':wear')
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-wearable:+'
}
这是穿戴库的build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.support:wearable:2.4.0'
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:wear:28.0.0'
compileOnly 'com.google.android.wearable:wearable:2.4.0'
}
感谢大家的帮助。我不是专业人士,所以答案可能非常明显且容易找到。另外,我不是以英语为母语的人,所以如果语法等不完美,我很抱歉。谢谢你的帮助。
【问题讨论】:
-
你好。 “无法在我的安卓智能手机上安装它”是什么意思?编译的结果是什么?
-
在我真正的智能手机上它只是说:不会安装。它编译得很好,但我只能在手表模拟器上运行应用程序,而不能在智能手机模拟器上运行,所以我无法测试移动模块
标签: android android-gradle-plugin build.gradle wear-os