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教程链接:链接地址

  • 相关阅读:
    Allegro PCB Design GXL (legacy) 使用slide无法将走线推挤到焊盘的原因
    OrCAD Capture CIS 16.6 导出BOM
    Altium Designer (17.0) 打印输出指定的层
    Allegro PCB Design GXL (legacy) 将指定的层导出为DXF
    Allegro PCB Design GXL (legacy) 设置十字大光标
    Allegro PCB Design GXL (legacy) 手动更改元器件引脚的网络
    magento产品导入时需要注意的事项
    magento url rewrite
    验证台湾同胞身份证信息
    IE8对css文件的限制
  • 原文地址:https://www.cnblogs.com/Im-Victor/p/11143151.html
Copyright © 2011-2022 走看看