diff --git a/README.md b/README.md index bd4a8f0..3ec1e6e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ * 项目地址:[Github](https://github.com/getActivity/Logcat) -* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/11.85/Logcat.apk) +* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/11.86/Logcat.apk) ![](picture/demo_code.png) @@ -51,7 +51,7 @@ dependencyResolutionManagement { ```groovy dependencies { // 日志调试框架:https://github.com/getActivity/Logcat - debugImplementation 'com.github.getActivity:Logcat:11.85' + debugImplementation 'com.github.getActivity:Logcat:11.86' } ``` @@ -66,6 +66,18 @@ android.enableJetifier = true * 如果项目是基于 **Support** 包则不需要加入此配置 +#### compileSdk 版本要求 + +* 如果项目的 `compileSdkVersion` 小于 29,则需要先升级成 29 + +```groovy +android { + compileSdkVersion 29 +} +``` + +* 如果项目的 `compileSdkVersion` 大于等于 29,则不需要修改此配置 + #### 使用方式 * 无需调用,直接运行,然后授予悬浮窗权限即可 diff --git a/common.gradle b/common.gradle index d305a7a..d4af972 100644 --- a/common.gradle +++ b/common.gradle @@ -8,8 +8,8 @@ android { minSdk 16 // Android 版本适配指南:https://github.com/getActivity/AndroidVersionAdapter targetSdk 34 - versionCode 1185 - versionName "11.85" + versionCode 1186 + versionName "11.86" } // 支持 Java JDK 8 diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index f9a07d5..e97058e 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -14,7 +14,16 @@ - + + + + + @@ -31,7 +40,20 @@ android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:windowSoftInputMode="stateHidden" /> - + + + + + + + diff --git a/library/src/main/java/com/hjq/logcat/LogcatService.java b/library/src/main/java/com/hjq/logcat/LogcatService.java index 269ee35..c2eb38d 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatService.java +++ b/library/src/main/java/com/hjq/logcat/LogcatService.java @@ -8,9 +8,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.content.pm.ServiceInfo; import android.graphics.BitmapFactory; -import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.IBinder; @@ -92,12 +90,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { } // 将服务和通知绑定在一起,成为前台服务 - if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && - VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { - startForeground(BACKUP_SERVICE_NOTIFICATION_ID, builder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC); - } else { - startForeground(BACKUP_SERVICE_NOTIFICATION_ID, builder.build()); - } + startForeground(BACKUP_SERVICE_NOTIFICATION_ID, builder.build()); return super.onStartCommand(intent, flags, startId); }