zoukankan      html  css  js  c++  java
  • Android Studio使用Gradle引入包

    方法一

    jar包直接复制到lib中右击add as library,等自动构建完成后,打开build.gradle会发现dependencies中多了一个compile file('libs/***.jar');

    方法二

    新建一个管理包的Module,File->new Module->Android Library。

    添加新建的包管理module,Project Structure,选中modules下面的项目,点击Dependencies,点击+号,选择Module Dependency,选择刚才新建的module。

    拓展:

    新建Android Library的包管理Module之后,Build项目,生成*.arr文件,复制到libs下面

    在build.gradle中添加如下代码

    android {
        repositories{
            flatdir{
                dirs 'libs'
            }
        }
    }
    
    dependencies {
        compile(name:"myadnroidlib",ext:"arr")
    }

    方法三(推荐)

    使用仓库

    Project中的build.gradle中配置仓库,使用jcenter仓库

    allprojects {
        repositories {
            jcenter()
        }
    }

    在app的build.gradle中dependendies下输入compile "***",可以到对应工具包的官网中找gradle添加的语句,类似于maven

    推荐用法

    配置好仓库后,点击Project Structure,选中modules下面的项目,点击Dependencies,点击+号,选择Library Dependency,输入要加入的包

  • 相关阅读:
    Windows安全事件日志中的事件编号与描述
    Apache启动失败,请检查相关配置。MySQL5.1已启动成功
    scrapy
    python 与mongodb 交互
    mongo 的导入和导出
    MongoDB
    json字符串和字典的区别补充
    第七章:错误处理
    第六章:个人主页和头像
    第五章:用户登录
  • 原文地址:https://www.cnblogs.com/aeolian/p/9461218.html
Copyright © 2011-2022 走看看