Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
myplxdm opened this issue Jul 27, 2022 · 6 comments
Open

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

myplxdm opened this issue Jul 27, 2022 · 6 comments

Comments

@myplxdm
Copy link

myplxdm commented Jul 27, 2022

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

@Zhanghao0150
Copy link

试试这个
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
}

@Just4fun2021
Copy link

试试这个 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.

@Zhanghao0150
Copy link

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

@Zhanghao0150
Copy link

Zhanghao0150 commented Aug 12, 2022

试试这个 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'

@df13954
Copy link

df13954 commented Aug 22, 2022

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

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

@Zhanghao0150
Copy link

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants