zoukankan      html  css  js  c++  java
  • Android 在同一个手机上安装多个相同的apk,便于调试

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


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

    apply plugin: 'com.android.application'
    android {
    
        compileSdkVersion 22
    
        buildToolsVersion "22.0.1"
    
    
    
        defaultConfig {
    
            applicationId "com.guoyoujin.gz.gz"
    
            minSdkVersion 14
    
            targetSdkVersion 22
    
            versionCode 1
    
            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都能正常使用, 给大家看下效果,看下面我已经安装了多个:

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

  • 相关阅读:
    db2缓冲池调优
    linux下安装rpm出现error: Failed dependencies
    linux下挂载磁盘
    db2 常见错误以及解决方案[ErrorCode SQLState]
    db2数据库表操作错误SQL0668N Operation not allowed for reason code "1" on table "表". SQLSTATE=57016的解决方法
    db2用户权限赋值
    db2查看当前用户模式及当前用户的权限
    loadrunner常用函数整理
    书上的脚本案例
    hdu 1711---KMP
  • 原文地址:https://www.cnblogs.com/Im-Victor/p/11143151.html
Copyright © 2011-2022 走看看