我在Google和SO上搜索过但找不到我的答案.
这是我第一次使用gradle系统,现在我正在生成一个已签名的APK上传到Google Play(Project是从eclipse导入的).
现在我已经阅读了这里的部分http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks你应该添加signingConfigs到你的build.gradle
我添加了这些行,现在我看到你需要运行./gradlew assembleRelease但在我的cmd中运行它返回'gradle'不被识别为内部或外部命令,可操作程序或批处理文件.我也尝试右键单击build.gradle并运行它,说它是成功的但是一旦我在build/apk文件夹中查看了一个名为app-debug-unaligned.apk
那么如何使用Gradle系统生成签名的apk?
我想构建Android应用程序并开始签名.为此,我需要有apk的发布版本.Google文档仅提供了Eclipse和ant方法来发布版本:http://developer.android.com/tools/publishing/app-signing.html#releasecompile
但是我找不到如何强制gradle build release版本的apk.build.gradle也没有提供任何提示.gradlew tasks建议,没有安装Release配置,但存在卸载版本:
Install tasks
-------------
installDebug - Installs the Debug build
installTest - Installs the Test build for the Debug build
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build
uninstallRelease - Uninstalls the Release build
uninstallTest - Uninstalls the Test build for the Debug build
Run Code Online (Sandbox Code Playgroud)
我的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
} …Run Code Online (Sandbox Code Playgroud) 我尝试像这个链接签署我的应用程序.我写了我的signingConfigs设置,但是我收到"找不到属性"错误.
这是我的build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "Andy Warhol"
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
signingConfig signingConfigs.myconfig
}
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
jniDebugBuild false
}
}
signingConfigs {
myconfig {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/picasso-2.2.0.jar')
compile files('libs/acra-4.5.0.jar') …Run Code Online (Sandbox Code Playgroud) 我想将一个应用程序提交给Google Market.我发现apk项目中只生成了一个文件,其路径是Project1Project/Project1/build/apk/Project1-debug-unaligned.apk
它看起来像是一个调试版本.我在哪里可以找到(如果有的话)应用程序的发布版本或者如何生成它?