如何更新本地aar包源 [英] how update local aar package sources

查看:566
本文介绍了如何更新本地aar包源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个Android Studio应用程序.其中之一是aar图书馆.我在第二个应用程序中使用了这个aar库.我通过使用File-> New-> New Module-> Import AAR/JAR Packages选项添加了aar库.之后,我可以看到我的aar库的反编译资源.更新aar库时,我将新的aar文件复制并粘贴到我的应用程序项目文件夹中.但是这次,Android Studio显示了较旧的反编译源.但是可以成功编译新的源代码.如何在Android Studio中更新反编译的源代码?当我导入aar文件implementation project(':app-debug')行时,添加了build.gradle文件.

I created two Android Studio applications. One of them is aar library. I used this aar library in second application. I added aar library by using File->New->New Module->Import AAR/JAR Packages option. after that I can see decompiled sources of my aar library. When I update aar library I copy and paste new aar file to my application project folder. But this time Android Studio shows older decompiled sources. But compile new source successfully. How can I update decompiled sources in Android Studio ? when I import aar file implementation project(':app-debug') line was added my build.gradle file.

我正在使用Android Studio 3.0.1

I am using Android Studio 3.0.1

我的解决方案

我找到更新本地资源的唯一方法是在更新aar/jar文件后单击与Gradle文件同步项目按钮.

the only way I can find to update local sources is clicking Sync Project with Gradle Files button after updating aar/jar file.

推荐答案

我遇到了同样的问题,曾尝试过将我的本地aar包括在项目中的每种形式,尝试了每种重建方法,使缓存无效等的方法,但是我当时更新libs文件夹中的文件后,仍然存在我的本地aar更改不可用的问题.

I was having the same issue, had tried every form of including my local aar in my project, tried every method of rebuilding, invalidating caches etc, but I was still having the problem where changes in my local aar were not available after updating the file in the libs folder.

唯一对我有用的是:

  1. 注释gradle中的实现文件('../libs/yourlib.aar')行
  2. 同步gradle
  3. 在libs文件夹中更新yourlib.aar
  4. 取消对gradle中的实现文件('../libs/yourlib.aar')行的注释
  5. 再次同步
  6. 构建项目

现在yourlib.aar中的更改应该在您的项目中可用.如果您将此lib包含在多个模块中,我想您将必须为每个模块执行此操作.这并不理想,但是我在这个问题上花了至少5个小时,而这些步骤似乎是我强制执行更改的唯一方法.我猜想从gradle文件中删除该库,然后进行同步将迫使它在再次添加新库时选择它.

Now the changes in yourlib.aar should be available in your project. If you have this lib included in multiple modules I am guessing you'll have to do it for each module. Not ideal, but I spent at least 5 hours on this issue and these steps were the only way I could seemingly force the changes. I am guessing that removing the library from the gradle file and then syncing will force it to pick up the new one when it is added again.

这篇关于如何更新本地aar包源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆