点击“生成签名的APK”确保从下拉列表中选择“移动”模块。包含磨损和移动模块的生成的APK将被命名为“mobile-release.apk”。此外settings.gradle应该有include ':mobile', ':wear'
存在,并且的build.gradle(模块:手机)应该补充
dependencies {
wearApp project(':wear')
}
编辑更多的内容/澄清如下
确定与此编辑希望我可以帮你解决你的问题!
首先,确保您运行的是Android Studio的最新稳定版本。截至今日,最新版本为Android Studio 1.1.0 我之前在早期版本中生成签名APK时出现了一些问题。其次确保你有最新的SDK文件,包括最新的API(API 22)。
一旦你有了这个设置,如果为你的应用程序生成一个有形的APK仍然不起作用。我会尝试制作一个新的android项目。将手机的最低SDK设置为API 18(4。3果冻豆,与Android Wear兼容的最低API级别)。并将Minimum Wear SDK设置为API 20(Android 4.4 KitKat Wear)。
然后尝试生成这个新项目的签名APK而不进行任何更改。这应该工作!如果你仍然有问题,那么有些事情会被严重破坏,我会从头开始重新安装Android工作室。
如果这个新项目的确有效,那么请注意这个工作项目的清单文件和gradle文件与其他非工作项目之间的差异。您发现的任何不一致可能都是您的问题。
最后三个文件:的build.gradle(项目:anAppImade)的build.gradle(Moduble:移动),和的build.gradle(模块:磨损)应该是这个样子(分别)这
构建。 gradle这个(项目:anAppImade)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
的build.gradle(Moduble:移动)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.ppltalkin.anappimade"
minSdkVersion 18
targetSdkVersion 22
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 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
}
的build.gradle(模块:磨损)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.ppltalkin.anappimade"
minSdkVersion 20
targetSdkVersion 22
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.1.0'
compile 'com.google.android.gms:play-services-wearable:6.5.87'
}
感谢您的快速帮助,但我做到了完全按照你们前面提到的。这个问题是,这两个文件都生成了,当我只选择移动安装。但这可能不重要或不正常。 但我总是得到措辞错误:/ – Botti560 2015-03-14 08:45:51
这些是我的移动相关性:依赖关系编译文件树(dir:'libs',包括:['* .jar']) wearApp项目(':wear')编译'com.android.support:appcompat-v7:21.0.3' compile'com.google.android.gms:play-services:6.5.87' compile“com.google.android.support:wearable:1.1 。+“ compile'com.android.support:support-v13:21.0.+' } – Botti560 2015-03-14 08:49:31
我编辑了我原来的帖子,希望它能帮助你! – Benjamin 2015-03-15 04:05:27