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

查看:37
本文介绍了如何更新本地 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 中的 implementation files('../libs/yourlib.aar') 行
  2. 同步gradle
  3. 更新 libs 文件夹中的 yourlib.aar
  4. 取消注释 gradle 中的 implementation files('../libs/yourlib.aar') 行
  5. 再次同步
  6. 构建项目

现在 yourlib.aar 中的更改应该在您的项目中可用.如果您将此库包含在多个模块中,我猜您必须为每个模块都这样做.不理想,但我在这个问题上至少花了 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天全站免登陆