您的位置:首页 > 移动开发 > Android开发

Android Studio中如何在Debug模式运行的时候自动签名

2015-05-18 20:19 405 查看
我们都知道,有些第三方平台的分享是要打签名包才能使用分享功能的,不能直接在debug包下使用,每次测试分享模块的时候都要单独安装签名包,这个操作也挺繁琐的.在Android Studio中可以通过配置gradle文件来实现在debug模式下就可以运行已经签名的包了.这个过程是自动完成.只需要配置如下:



其中xxx.keystore为当前app的签名文件
代码如下;
signingConfigs {
myConfig {
storeFile file("../xxx.keystore")
keyAlias '别名'
keyPassword '签名文件的密码'
storePassword '签名文件存储的密码'
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi"
}
// 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
zipAlignEnabled true
// 移除无用的resource文件
shrinkResources true
signingConfig signingConfigs.myConfig
//minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), '../xxx-android.txt'
}
debug {
ndk {
abiFilters "armeabi"
}
// 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
zipAlignEnabled true
// 移除无用的resource文件
shrinkResources true
signingConfig signingConfigs.myConfig
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: