Android developers should collect the following utils

Overview

logo

frame

auc result build License

README of Chinese

About

AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥

Documentation

utilcode

subutil

Donations

If this project helps you a lot and you want to support the project's development and maintenance of this project, feel free to scan the following QR code for donation. Your donation is highly appreciated. Thank you!

donate

Contact

Blog jianshu weibo QQGroup

Change Log

打个小广告

欢迎加入我的小专栏「基你太美」一起学习。

Comments
  • [BUG] 1.28.x 汇总

    [BUG] 1.28.x 汇总

    版本变更

    1.27.x 重构版本经过多次的 BUG 修复已趋于稳定,欢迎大家使用 1.28.x。

    BUG 描述模板

    拷贝如下模板到下方来提交 BUG

    ## 描述 Bug
    
    简洁地描述下 Bug。
    - AndroidUtilCode 的版本:例如 utilcode:1.28.0 或 utilcodex:1.28.0
    - 出现 Bug 的设备型号: 例如 Nexus 5X
    - 设备的 Android 版本:例如 API 27
    
    ## 相关代码
    
    ```
    put your code here
    ```
    
    ## 异常堆栈
    
    ```
    put the stack of crash here
    ```
    
    ## 截图
    
    如果有的话请添加屏幕截图以帮助解释问题。
    
    bug 
    opened by Blankj 50
  • 屏幕适配xdpi赋值没有成功

    屏幕适配xdpi赋值没有成功

    我的两个设备都是华为M2,一个是16g的一个是64g的。 在执行val dm = getDisplayMetrics(resources)这个代码之后我打印了dm。 16g的信息是DisplayMetrics:DisplayMetrics{density=1.5, width=1920, height=1200, scaledDensity=1.5, xdpi=108.0, ydpi=224.737},

    64g的信息是:DisplayMetrics:DisplayMetrics{density=1.5, width=1920, height=1128, scaledDensity=1.5, xdpi=225.777, ydpi=224.737}

    最后打印的val newXdpi = dm.xdpi这个值都是108.0到这是没有问题的。 等到控件绘制的时候我发现我的xdpi这个值在64g的设备中并没有赋值成功,打印的还是原始值 xdpi=225.777(如果赋值成功的话xdpi应该是108.0)

    下面附上效果: 这是64g的设备 Screenshot_2019-03-14-15-00-07

    Screenshot_2019-03-14-14-59-54

    Screenshot_2019-03-14-15-00-18 这个显然是不对的,但是我把这个设备的屏幕旋转为竖屏时好像是对的

    微信图片_20190314151623

    以下是16g的设备截图,是正常的 Screenshot_2019-03-14-15-01-01

    Screenshot_2019-03-14-15-00-55

    Screenshot_2019-03-14-15-00-41

    想问下这种情况应该是怎么回事?

    注:以上我说的16g和64g只是为了区分两个设备的不同

    opened by BeatGeneration 43
  • [BUG] 1.27.x 汇总

    [BUG] 1.27.x 汇总

    版本变更

    升级到 1.27.x 版本发生了重构,所带来的 bug 可能比较多,在此深表歉意,目前已修复差不多了 :-)

    • 最新版本:1.27.6
    • 1.27.0 版本变更详情: https://github.com/Blankj/AndroidUtilCode/releases/tag/1.27.0
    • 1.27.1:
      • 修复 ActivityUtils finish 堆栈不正确的 BUG
      • 修复 PathUtils 中判断 SD 卡状态反了的 BUG
    • 1.27.2:
      • 修复 UtilsActivityLifecycleImpl 的 HashMap#remove IllegalStateException Bug
      • 修复 ShadowUtils 阴影低版本问题
    • 1.27.3:
      • 修改 GsonUtils#getGson() 为 public
      • 修复 LogUtils 写入文件不起作用
      • 修复 CrashUtils 设置的 DefaultUncaughtExceptionHandler 导致的卡死现象
      • 修复 Utils#getApp 多进程获取为空的问题
    • 1.27.4
    • 1.27.5
      • 修复 ActivityUtils finish 不正确的 BUG
    • 1.27.6
      • 修复 FileUtils#isFileExists
      • 修复 FragmentUtils#getTop

    BUG 描述模板

    拷贝如下模板到下方来提交 BUG

    ## 描述 Bug
    
    简洁地描述下 Bug。
    - AndroidUtilCode 的版本:例如 utilcode:1.27.0 或 utilcodex:1.27.0
    - 出现 Bug 的设备型号: 例如 Nexus 5X
    - 设备的 Android 版本:例如 API 27
    
    ## 相关代码
    
    ```
    put your code here
    ```
    
    ## 异常堆栈
    
    ```
    put the stack of crash here
    ```
    
    ## 截图
    
    如果有的话请添加屏幕截图以帮助解释问题。
    
    bug 
    opened by Blankj 38
  • ToastUtil 在华为平板7.0的系统上有问题,会引起其他控件的错误

    ToastUtil 在华为平板7.0的系统上有问题,会引起其他控件的错误

    2018-10-19 10:50:38.291 9028-9028/com.tendao.rushrepair E/InputEventReceiver: Exception dispatching input event. 2018-10-19 10:50:38.291 9028-9028/com.tendao.rushrepair E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 2018-10-19 10:50:38.296 9028-9028/com.tendao.rushrepair E/MessageQueue-JNI: android.content.res.Resources$NotFoundException: Drawable android:drawable/text_select_handle_middle_material with resource ID #0x1080761 Caused by: android.content.res.Resources$NotFoundException: File res/drawable/text_select_handle_middle_material.xml from drawable resource ID #0x1080761 at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:935) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:769) at android.content.res.Resources.getDrawable(Resources.java:834) at android.content.Context.getDrawable(Context.java:529) at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:5221) at android.widget.Editor$InsertionPointCursorController.show(Editor.java:5200) at android.widget.Editor.onTouchUpEvent(Editor.java:2196) at android.widget.TextView.onTouchEvent(TextView.java:8854) at android.view.View.dispatchTouchEvent(View.java:10013)

    opened by glmsb 23
  • 屏幕适配问题汇总及解决

    屏幕适配问题汇总及解决

    适配的原理及怎么适配?

    Android 屏幕适配从未如斯简单(8月10日最终更新版),由于文章写的较早,请用 1.19.2 版本及以上来完美适配。

    如何创建 mdpi 1080 * 1920 设备的预览图?

    创建新的模拟器设备,然后修改分辨率和屏幕尺寸使其达到 mdpi 即可。

    App 进入后台一段时间再进入导致适配失效?

    由于进入后台可能会触发 onDestroy,导致取消了适配,从而再次进入 App 的时候可能会出现适配失效。如果是所有页面都需要适配,那就不需要在 onDestroy 里做取消适配;如果某些页面不需要适配,那就在它 setContentView 之前取消适配即可。

    webview 加载后发现 density 复原?

    由于 WebView 初始化的时候会还原 density 的值导致适配失效,继承 WebView,重写如下方法:

    @Override
    public void setOverScrollMode(int mode) {
        super.setOverScrollMode(mode);
        ScreenUtils.restoreAdaptScreen();
    }
    

    如何让系统 View 尺寸正常?

    后面提到的 Dialog 和 Toast 其实都可以用用这种解决方案,就是在 inflate 相关 View 之前调用 ScreenUtils#cancelAdaptScreenshow 之后调用 ScreenUtils#restoreAdaptScreen 即可,这样就可以让系统 View 显示正常尺寸。

    显示 dialog 尺寸有问题?

    如果你适配传入的不是 mdpi 下的尺寸,而是 xxhdpi,那么可能会导致 AlertDialog 跑到屏幕外边,所以在文章中我也提到了只用 mdpi 来适配,正常情况的 mdpi 是会呈现比较小的尺寸,如果你要取得和原生一致的效果,那就利用上面提到的「如何让系统 View 尺寸正常」封装下在 Dialog 显示前调用 ScreenUtils#cancelAdaptScreen,Dismiss 后根据需求看是否需要 ScreenUtils#restoreAdaptScreen;或者你也可以给 Dialog 定制统一的 styles 来解决尺寸(<item name="android:windowMinWidthMinor">576dp</item> <!-- 占 80% 屏宽 720 * 0.8 = 576 -->)、字体的问题。当然,如果项目组有封装好的 Dialog,那么统一修改这个 Dialog 库的尺寸即可。

    Toast 尺寸有问题?

    使用 1.19.1 及以上版本的 ToastUtils 来显示 Toast 不会有这个问题(解决之道就是上面提到的「如何让系统 View 尺寸正常」),当然你也可以自己封装不用我的 ToastUtils;或者参照 CustomToast 来自定义 Toast 布局。

    更大尺寸的设备想要显示更多的内容?

    可以使用 sw 的方案来解决尺寸更大的设备可以显示更多的内容,本方案和 sw 并没有冲突,所以如果你需要在全面屏或者大屏设备显示更多的内容可以创建新的 dimens 来解决,这样就可以做到在某一尺寸范围内的设备显示效果都一致,解决了某些人总是口口声声说「更大的屏幕就应该获取更多的信息啊」。

    enhancement 
    opened by Blankj 22
  • Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/3033

    Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/3033

    Describe the bug

    A clear and concise description of what the bug is.

    • The version of utilcode: 1.23.7
    • The device: 小米6
    • The version of device: API 26

    The code of bug

    UriUtils.uri2File
    
    @Override
        protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == 111 && data != null) {
                if (resultCode == Activity.RESULT_OK) {
                    Uri uri = data.getData();
                    File file = UriUtils.uri2File(FilePickerActivity.this, uri);
                    String absolutePath = file.getAbsolutePath();
                }
            }
        }
    

    The stack of crash

    2019-03-08 14:15:38.213 8143-8143/? E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.wiki.cc, PID: 8143
        java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=111, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/3033 flg=0x1 }} to activity {com.wiki.cc/com.wiki.cc.ui.a.FilePickerActivity}: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/3033
            at android.app.ActivityThread.deliverResults(ActivityThread.java:4391)
            at android.app.ActivityThread.handleSendResult(ActivityThread.java:4434)
            at android.app.ActivityThread.-wrap19(Unknown Source:0)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1678)
            at android.os.Handler.dispatchMessage(Handler.java:105)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:6701)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
         Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/3033
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:165)
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
            at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
            at android.content.ContentResolver.query(ContentResolver.java:756)
            at android.content.ContentResolver.query(ContentResolver.java:705)
            at android.content.ContentResolver.query(ContentResolver.java:663)
            at com.wiki.cc.util.UriUtils.getFileFromUri(UriUtils.java:120)
            at com.wiki.cc.util.UriUtils.getFileFromUri(UriUtils.java:113)
            at com.wiki.cc.util.UriUtils.uri2File(UriUtils.java:79)
            at com.wiki.cc.ui.a.FilePickerActivity.onActivityResult(FilePickerActivity.java:53)
            at android.app.Activity.dispatchActivityResult(Activity.java:7310)
            at android.app.ActivityThread.deliverResults(ActivityThread.java:4387)
            at android.app.ActivityThread.handleSendResult(ActivityThread.java:4434) 
            at android.app.ActivityThread.-wrap19(Unknown Source:0) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1678) 
            at android.os.Handler.dispatchMessage(Handler.java:105) 
            at android.os.Looper.loop(Looper.java:176) 
            at android.app.ActivityThread.main(ActivityThread.java:6701) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) 
    
    opened by newlai913 21
  • studio 3.2.1 无法编译

    studio 3.2.1 无法编译

    Failed to transform file 'android.jar' to match attributes {artifactType=android-mockable-jar, returnDefaultValues=false} using transform MockableJarTransform

    opened by tianshaokai 20
  • 【BusUtils】是否有区分基类和子类。

    【BusUtils】是否有区分基类和子类。

    Describe the bug

    A clear and concise description of what the bug is.

    • The version of utilcode:
    • The device:
    • The version of device:

    BusUtils在baseActivity中接收不到,在继承的子类中却可以。 EventBus都可以。 柯基大大,什么原因呢?

    opened by LouisKooAndroid 19
  •  Unable to get provider com.blankj.utilcode.util.Utils$FileProvider4UtilCode

    Unable to get provider com.blankj.utilcode.util.Utils$FileProvider4UtilCode

    java.lang.RuntimeException: Unable to get provider com.blankj.utilcode.util.Utils$FileProvider4UtilCode: java.lang.ClassNotFoundException: Didn't find class "com.blankj.utilcode.util.Utils$FileProvider4UtilCode" on path: DexPathList[[zip file "/data/app/com.njsoft.retrofittest-1/base.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.njsoft.retrofittest-1/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5856) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.blankj.utilcode.util.Utils$FileProvider4UtilCode" on path: DexPathList[[zip file "/data/app/com.njsoft.retrofittest-1/base.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.njsoft.retrofittest-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.njsoft.retrofittest-1/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5841) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)  at android.app.ActivityThread.-wrap2(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6119)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

    opened by Cuiernao 18
  • Warning:A class activity declared in the AndroidManifest.xml cannot be found in the compile path: [com.blankj.utilcode.util.PermissionUtils$PermissionActivity]

    Warning:A class activity declared in the AndroidManifest.xml cannot be found in the compile path: [com.blankj.utilcode.util.PermissionUtils$PermissionActivity]

    I am receiving this error while compile and run after activating proguard

    Proguard:

    -dontwarn com.squareup.okhttp.**
    
    #android utils
    -keep class com.blankj.utilcode.** { *; }
    -keep class com.blankj.utilcode.util.** { *; }
    -keepclassmembers class com.blankj.utilcode.** { *; }
    -dontwarn com.blankj.utilcode.**
    
    #FFMPEGMetaDataReceiver rules
    -keep class wseemann.media.** { *; }
    
    #android annotation
    -optimizationpasses 5
    -dontusemixedcaseclassnames
    -dontskipnonpubliclibraryclasses
    -dontpreverify
    -verbose
    -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
    
    -keep public class * extends android.app.Activity
    -keep public class * extends android.app.Application
    -keep public class * extends android.app.Service
    -keep public class * extends android.content.BroadcastReceiver
    -keep public class * extends android.content.ContentProvider
    -keep public class * extends android.app.backup.BackupAgentHelper
    -keep public class * extends android.preference.Preference
    -keep public class com.android.vending.licensing.ILicensingService
    
    -keepclasseswithmembernames class * {
        native <methods>;
    }
    
    -keepclasseswithmembernames class * {
        public <init>(android.content.Context, android.util.AttributeSet);
    }
    
    -keepclasseswithmembernames class * {
        public <init>(android.content.Context, android.util.AttributeSet, int);
    }
    
    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    
    -keep class * implements android.os.Parcelable {
      public static final android.os.Parcelable$Creator *;
    }
    

    build.gradle(app):

    apply plugin: 'com.android.application'
    
    def AAVersion = '4.3.1'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.some.myapp"
            minSdkVersion 21
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            debug {
                resValue "string", "dev_version", "v 1.0.0"
                buildConfigField "boolean", "SHOW_ADS", "false"
    
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    
            }
            release {
                resValue "string", "dev_version", "v 1.0.0"
                buildConfigField "boolean", "SHOW_ADS", "false"
    
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation ('com.android.support:appcompat-v7:27.1.0'){force true}
        implementation ('com.android.support:design:27.1.0'){force true}
        implementation ('com.android.support:support-v4:27.1.0'){force true}
        implementation ('com.android.support:cardview-v7:27.1.0'){force true}
        implementation ('com.android.support:recyclerview-v7:27.1.0'){force true}
    
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    
        implementation "org.androidannotations:androidannotations-api:$AAVersion"
        annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    
        implementation 'com.github.hotchemi:android-rate:1.0.1'
        implementation 'com.google.firebase:firebase-ads:11.8.0'
    
        //RX Java
    //    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    //    implementation 'io.reactivex.rxjava2:rxjava:2.1.5'
    
    
        implementation 'com.github.machinarius:preferencefragment:0.1.1'
    
        implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    
        implementation 'com.blankj:utilcode:1.12.6'
    
        // for checking meta data and stuff of video
        implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
    
        implementation 'joda-time:joda-time:2.9.9'
    
        implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
    
    }
    

    What am i doing wrong , or is it a bug ?

    opened by Zulqurnain 17
  • UriUtils.uri2File(uri)选择下载内容里的文件会崩溃

    UriUtils.uri2File(uri)选择下载内容里的文件会崩溃

    Caused by: java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/app-release1.30.apk" at java.lang.Long.parseLong(Long.java:594) at java.lang.Long.valueOf(Long.java:808) at com.blankj.utilcode.util.UriUtils.uri2File(UriUtils.java:81)

    image Long.valueOf(id),id是"raw:/storage/emulated/0/Download/app-release1.30.apk"

    opened by beiger 16
  • utilcode:1.30.6或1.31.1引入后启动应用就会在”SD卡/Android/media/“路径下创建对应包名的文件夹,未授权存储权限的情况下存在调用外部SD卡的读写权限的情况

    utilcode:1.30.6或1.31.1引入后启动应用就会在”SD卡/Android/media/“路径下创建对应包名的文件夹,未授权存储权限的情况下存在调用外部SD卡的读写权限的情况

    utilcode:1.30.6或1.31.1引入后启动应用就会在”SD卡/Android/media/“路径下创建对应包名的文件夹,未授权存储权限的情况下存在调用外部SD卡的读写权限的情况

    在启动应用未调用任何初始化代码,也会触发创建文件夹得操作。

    • AndroidUtilCode 的版本:utilcode:1.30.6和1.31.1
    • 出现 Bug 的设备型号:所有设备
    • 设备的 Android 版本:所有版本

    未调用初始化代码,只是引入到项目中

    implementation ('com.blankj:utilcodex:1.31.1')
    

    异常详情

    {"mkdir": "/storage/emulated/0/Android/media"}
    

    异常堆栈

    java.io.File.mkdir(File.java:1380)
    java.io.File.mkdirs(File.java:1429)
    java.io.File.mkdirs(File.java:1428)
    android.app.ContextImpl.ensureExternalDirsExistOrFilter(ContextImpl.java:2464)
    android.app.ContextImpl.getExternalMediaDirs(ContextImpl.java:694)
    android.content.ContextWrapper.getExternalMediaDirs(ContextWrapper.java:287)
    androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:28)
    androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:3)
    androidx.core.content.FileProvider.attachInfo(FileProvider.java:4)
    android.app.ActivityThread.installProvider(ActivityThread.java:6583)
    android.app.ActivityThread.installContentProviders(ActivityThread.java:6149)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:6066)
    android.app.ActivityThread.-wrap1(Unknown Source:0)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1988)
    android.os.Handler.dispatchMessage(Handler.java:106)
    android.os.Looper.loop(Looper.java:164)
    android.app.ActivityThread.main(ActivityThread.java:6843)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
    

    截图

    image

    bug 
    opened by xiaobenssss 13
  • 集成Bus 插件后,编译通过,但是运行报错

    集成Bus 插件后,编译通过,但是运行报错

    描述 Bug

    简洁地描述下 Bug。

    • AndroidUtilCode 的版本:
    • 出现 Bug 的设备型号:
    • 设备的 Android 版本:

    相关代码

    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.blankj.utilcode.util.Utils$TransActivity$TransActivityDelegate"

    异常堆栈

    put the stack of crash here
    

    截图

    如果有的话请添加屏幕截图以帮助解释问题。 image

    请删除当前行及以下内容

    感谢支持 AndroidUtilCode.

    bug 
    opened by androidmoyan1992 1
  • executeByFixedWithDelay 执行完成之后,会释放掉吗?

    executeByFixedWithDelay 执行完成之后,会释放掉吗?

    Describe the bug

    A clear and concise description of what the bug is.

    • The version of AndroidUtilCode:
    • The device:
    • The version of device:

    The code of bug

    put your code here
    

    The stack of crash

    put the stack of crash here
    

    Screenshots

    If applicable, add screenshots to help explain your problem.

    Please delete the current line and the following.

    Thank you for supporting AndroidUtilCode.

    bug 
    opened by llnqykfa 0
  • 获取导航栏高度方法

    获取导航栏高度方法

    描述 Bug

    由于安卓12L新增加了任务栏功能,当前获取导航栏高度方法是不是需要兼容下

    • AndroidUtilCode 的版本:utilcodex:1.30.1
    • 出现 Bug 的设备型号:三星Galaxy Z Fold4
    • 设备的 Android 版本:Android 13

    相关代码

    int navBarHeight ;
    WindowInsetsCompat rootWindowInsets = ViewCompat.getRootWindowInsets(findViewById(android.R.id.content));
    if (rootWindowInsets != null) {
      int top = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).top;
      int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
      int height = Math.abs(bottom - top);
      if (height > 0) {
          navBarHeight = height;
      } else {
          navBarHeight = BarUtils.getNavBarHeight();
      }
    }
    
    bug 
    opened by goodluckier 0
Releases(1.31.1)
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

null 951 Jan 5, 2023
java common utils library

java-common-utils java common utils library 一个简单的Java通用工具类,目前的设想,包括简化异常处理工具、简易限流处理工具等 ExceptionHandler, 目标简化try catch的代码冗余度

xuangy 2 Jan 21, 2022
Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon

Stfalcon Fixturer A Utility for developers and QAs which helps minimize time wasting on writing the same data for testing over and over again. You can

Stfalcon LLC 31 Nov 29, 2021
This is a repository to collect JUnit Tests for GAD exercises at TUM in SS21

TUM_GAD_Tests_SS21 This is a repository to collect JUnit Tests for GAD exercises at TUM in SS21. These tests have been written by students for student

null 41 Oct 31, 2022
A Pomodoro Timer that allows you to collect Pokemon as you work.

Pomodoro: The Pokémon Collecting Game! A fun take on the Pomodoro Technique So, what does this application do? This application utilizes the famous Po

Kevin Wong 2 Jan 29, 2022
Properly implements shields being able to block endcrystal blasts, as they should; like every other explosion type.

Endcrystal-Shield Properly implements shields being able to block endcrystal blasts, as they should; like every other explosion type. Mojang CONFIRMED

Ian 3 Jul 7, 2022
A Recruitment bot that uses K-Nearest Neighbors Algorithm to determine whether you should hire the applicant or not

knn_recruitment A Recruitment bot that uses K-Nearest Neighbors Algorithm to determine whether you should hire the applicant or not It uses the data i

null 1 Feb 11, 2022
This repository should serve as a guide to everybody who wants to study software and hardware for embedded systems but doesn't know where to start.

Roadmap to Embedded Engineering This repository should serve as a guide to anyone who wants to study software and hardware for embedded systems but do

Mateus Antonio da Silva 108 Jan 4, 2023
In the application, users should be able to register, login and create/update/delete their own to-do lists.

Mini TO-DO app About the project Todoist In the application, users should be able to register, login and create/update/delete their own to-do lists. Y

Hüseyin Balicak 2 Nov 22, 2022
Cron utils for parsing, validations and human readable descriptions as well as date/time interoperability.

cron-utils We define crons. And support them. cron-utils is a Java library to define, parse, validate, migrate crons as well as get human readable des

jmrozanec 965 Dec 30, 2022
Commons networking related utils.

commons-networking Commons networking related utils. Note: This is not an official Cisco product. Features SSE (Server-sent Events) client GNMI Utils

Cisco Systems Engineers 6 Dec 22, 2022
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

null 951 Jan 5, 2023
Swerve control, simulation, and trajectory generation / following. Everything you need for swerve.

BearSwerve BearSwerve is intended to be an all in one swerve solution including: teleop driving, simulation, trajectory following and more. It combine

null 7 Dec 28, 2022
java common utils library

java-common-utils java common utils library 一个简单的Java通用工具类,目前的设想,包括简化异常处理工具、简易限流处理工具等 ExceptionHandler, 目标简化try catch的代码冗余度

xuangy 2 Jan 21, 2022
A simple blog post api made with spring,mysql.Following tutorial by @FadatareRamesh(Java Guides)

blogAPI A simple blog post api made with spring,mysql.Following tutorial by @FadatareRamesh(Java Guides) Frontend server(made using Angular) can be fo

null 1 Feb 2, 2022
Example project of Spring Boot Microservices with the following services School and Student

SpringBootMicroservicesWithDiscoveryGatewayConfig Example project of Spring Boot Microservices with the following services School and Student, additio

Gábor Hutya 2 Nov 28, 2022
Java with functions is a small java tools and utils library.

Java with functions is a small java tools and utils library.

null 4 Oct 14, 2022
Usign ascii characters, recreate an image following a local path

CMDImage Usign ascii characters, recreate an image following a local path README El código toma una imagen desde una ruta local para convertirlo en ca

Alexander Hernández 13 Aug 30, 2022
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023