kezong / fat-aar-android

A gradle plugin that merge dependencies into the final aar file works with AGP 3.+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我在打包一个module为aar时发现glide无法完全导出

myplxdm opened this issue · comments

embed ('com.github.bumptech.glide:glide:4.13.2')
这种打包出来的aar glide中会少了gif包下面的所有文件,使得使用相关库的闪退,虽然这个库为常用库,但因为我方是开发sdk的,所以为了方便只要求用户导入远程依赖的一个库。

commented

试试这个
fataar {
/**
* If transitive is true, local jar module and remote library's dependencies will be embed. (local aar module does not support)
* If transitive is false, just embed first level dependency
* Default value is false
* @SInCE 1.3.0
*/
transitive = true
}

试试这个 fataar { /** * If transitive is true, local jar module and remote library's dependencies will be embed. (local aar module does not support) * If transitive is false, just embed first level dependency * Default value is false * @SInCE 1.3.0 */ transitive = true }

感谢您的回复,但是加了这个编译报错 > Cannot add task 'explodeAndroidx.lifecycleLifecycle-viewmodelDebug' as a task with that name already exists.

commented

将工程有依赖androidx.core:core的去掉,你可以看看这个报错,希望对你有帮助。#347

commented

试试这个 fataar { /** * If transitive is true, local jar module and remote library's dependencies will be embed. (local aar module does not support) * If transitive is false, just embed first level dependency * Default value is false * @SInCE 1.3.0 */ transitive = true }

感谢您的回复,但是加了这个编译报错 > Cannot add task 'explodeAndroidx.lifecycleLifecycle-viewmodelDebug' as a task with that name already exists.
根据[#347 ]的问题回复情况来看,你可以尝试以下方法看是否可以解决

尝试解决办法1:
找到所有依赖了将Androidx的配置,将 core 模块剔除
implementation 'androidx.appcompat:appcompat:1.3.0'
改为
implementation ('androidx.appcompat:appcompat:1.3.0') {
exclude group: 'androidx.core' , module : 'core'
}
尝试解决办法2:
降级Androidx版本为 1.2.0
implementation 'androidx.appcompat:appcompat:1.2.0'

embed ('com.github.bumptech.glide:glide:4.13.2') 这种打包出来的aar glide中会少了gif包下面的所有文件,使得使用相关库的闪退,虽然这个库为常用库,但因为我方是开发sdk的,所以为了方便只要求用户导入远程依赖的一个库。

可以不可以编译的时候用compile only,然后让客户端那边imp一个指定版本的glide呢

commented

embed ('com.github.bumptech.glide:glide:4.13.2') 这种打包出来的aar glide中会少了gif包下面的所有文件,使得使用相关库的闪退,虽然这个库为常用库,但因为我方是开发sdk的,所以为了方便只要求用户导入远程依赖的一个库。

可以不可以编译的时候用compile only,然后让客户端那边imp一个指定版本的glide呢

可以考虑把这个图片加载框架抽象一个接口出来,让sdk的用户去实现,或者去github下载glide下来改包名,重新编译一个本地库进行合并

interface ImageLoadCallback {
void onResponse(Bitmap bitmap);
}
interface ImageLoader {
Bitmap loadImageSync(String uri, int width, int height);
void loadImage(String uri, int width, int height, ImageLoadCallback imageLoadCallback);
}