首页 技术 正文
技术 2022年11月10日
0 收藏 568 点赞 3,151 浏览 1866 个字

Android studio 在同一个手机上安装多个相同的apk
原文地址:http://yj.itrydo.com/posts/iKJryXL9zkfSGRTZk
先看效果:
Android 在同一个手机上安装多个相同的apk,便于调试

1.在我使用ecslipse的时候我一直在研究“Android studio 在同一个手机上安装多个相同的apk”这个问题,可是每次都不能如自己所愿,一个最笨的方法就是修改项目的包名,但明显这是一个不靠谱的事情,从去年开始接触android studio,终于找到了怎么在一个手机上安装多个相同的apk了,这还得感谢Gradle-Plugin这个插件,很是强大,废话不多说直接上代码:
下面是我的一个build

apply plugin: 'com.android.application'
android { compileSdkVersion buildToolsVersion "22.0.1" defaultConfig { applicationId "com.guoyoujin.gz.gz" minSdkVersion targetSdkVersion versionCode versionName "1.0" } buildTypes { debug { applicationIdSuffix "debug" } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}repositories { maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }}dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:support-v4:22.2.0' compile 'com.nineoldandroids:library:2.4.0' compile 'com.ogaclejapan.smarttablayout:library:1.1.3@aar' compile 'com.ogaclejapan.smarttablayout:utils-v4:1.1.3@aar' compile 'com.android.support:recyclerview-v7:22.2.0' compile 'com.android.support:support-v13:22.2.0' compile 'com.google.code.gson:gson:2.2.4' compile 'com.facebook.fresco:fresco:0.5.0' compile 'com.orhanobut:logger:1.10' compile 'org.lucasr.twowayview:core:1.0.0-SNAPSHOT@aar' compile 'org.lucasr.twowayview:layouts:1.0.0-SNAPSHOT@aar' compile files('libs/universal-image-loader-1.9.1-with-sources.jar') compile files('libs/com.hck.book.jar') compile files('libs/Msc.jar') compile files('libs/pinyin4j-2.5.0.jar')}

重点就在这里:

 buildTypes {        debug {            applicationIdSuffix "debug"        }        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }

这个debug的applicationIdSuffix随便改都能生成你想要的测试apk的applicationid啦,懂 android的一定知道这是什么概念了
这意味的你可以随意安装一个不同的app了,这是多么牛逼,你在也不用害怕不能给测试人员装多个apk了,这些apk都能正常使用, 给大家看下效果,看下面我已经安装了多个:

Android 在同一个手机上安装多个相同的apk,便于调试

这里附上一个权威Gradle-Plugin教程链接:链接地址

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,490
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,905
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,738
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,491
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,129
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,292