zoukankan      html  css  js  c++  java
  • Android Studio导出jar包

    Eclipse直接有个Export,可以直接导出jar包。AS相对Eclipse变化很大,编译脚本变成了Gradle,各种导包操作都有差异。

    下面是AS导出jar的过程:

    第一步,修改app下的build.grade。

    apply plugin: 'com.android.application'
    

    修改为

    apply plugin: 'com.android.library'
    

    第二步,增加一些配置。

    task makeJar(type: Copy) {    
        delete 'build/libs/uzAMap.jar'  
        from('build/intermediates/bundles/release/')    
        into('build/libs/')    
        include('classes.jar')    
        rename ('classes.jar', 'uzAMap.jar')
    }
    makeJar.dependsOn(build)
    
    

    第三步,去除applicationId

    defaultConfig {
            applicationId "com.apicloud.amap"
            minSdkVersion 14
            targetSdkVersion 21
    }
    

    改为

    defaultConfig {
            minSdkVersion 14
            targetSdkVersion 21
    }
    

    第四步,进入Terminal,执行脚本。

    gradlew makeJar
    

    完整的build.gradle

    apply plugin: 'com.android.library'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "26.0.2"
    
        defaultConfig {
            applicationId "com.apicloud.amap"
            minSdkVersion 14
            targetSdkVersion 21
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    dependencies {
        compile 'com.android.support:support-v4:23.4.0'
        compile files('libs/AMap_3DMap_V3.3.2_20160525.jar')
        compile files('libs/AMap_Location_V2.4.1_H5.jar')
        compile files('libs/AMap_Search_V3.2.1_20160308.jar')
        compile files('libs/apiEngine v1.1.0.jar')
        compile files('libs/xUtils-2.6.1.jar')
    }
    
    task makeJar(type: Copy) {
        delete 'build/libs/uzAMap.jar'
        from('build/intermediates/bundles/release/')
        into('build/libs/')
        include('classes.jar')
        rename ('classes.jar', 'uzAMap.jar')
    }
    makeJar.dependsOn(build)
    
    
    

  • 相关阅读:
    pandas 学习 第2篇:Series -(创建,属性,转换和索引)
    pandas 学习 第1篇:pandas基础
    linux中的软连接和硬链接
    分布式与集群的简单讲解
    Redis持久化
    CentOS7安装后无法使用鼠标选中,复制问题解决
    centos 7 安装 ifconfig 管理命令
    ES分布式文档数据库讲解
    Storm,Spark和Flink三种流式大数据处理框架对比
    mvn常见参数命令讲解
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/7762256.html
Copyright © 2011-2022 走看看