美文网首页
在Android Studio Arctic fox中使用自定义

在Android Studio Arctic fox中使用自定义

作者: 浪里_个郎 | 来源:发表于2021-12-28 11:19 被阅读0次

老版本AS请参考:
https://www.jianshu.com/p/7073ef7da075?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

新版本AS中,可以使用以下方式导入自定义framework.jar:

  1. 新建一个module,可命名为“frameworks”,将framework.jar直接放入


  2. 该module的build.gradle内容如下:

configurations.maybeCreate("default")
artifacts.add("default", file('framework.jar'))
  1. 在应用的build.gradle中增加:
allprojects {
  ...
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            Set<File> fileSet = options.bootstrapClasspath.getFiles()
            List<File> newFileList = new ArrayList<>()
            newFileList.add(new File("frameworks/framework.jar"))
            newFileList.addAll(fileSet)
            options.bootstrapClasspath = files(newFileList.toArray())
        }
    }
}

相关文章

网友评论

      本文标题:在Android Studio Arctic fox中使用自定义

      本文链接:https://www.haomeiwen.com/subject/cvcpqrtx.html