gpt4 book ai didi

android - Android Studio升级Gradle错误

转载 作者:行者123 更新时间:2023-12-03 04:33:54 24 4
gpt4 key购买 nike

我正在使用Google Service Gradle

compile 'com.google.android.gms:play-services:8.1.0'
=> Bitmap bitmap = BitmapFactory.decodeFile(imagePath); // return bitmap

当我升级到
compile 'com.google.android.gms:play-services-ads:8.4.0'
=> Bitmap bitmap = BitmapFactory.decodeFile(imagePath); // return null ??!!

为什么会这样呢?解决方案是什么?

最佳答案

i am using same gradle
compile 'com.google.android.gms:play-services-ads:8.4.0'
i am sure issue is with your file path
check below code for testing put an image test.jpg in your DCIM folder and run this code
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
String imageInSD = "/sdcard/DCIM/test.jpg";
Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
if(bitmap == null){
Toast.makeText(getActivity(),"not found",Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(getActivity(),"found",Toast.LENGTH_SHORT).show();
imageView.setImageBitmap(bitmap);
}

关于android - Android Studio升级Gradle错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35627616/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com