我正在尝试实现新的主题图标,但遇到的问题是我的图标总是放大 2 倍,并且无法使其适合画布。
下面您可以看到左侧为普通图标,右侧为主题图标。
ic_启动器
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
Run Code Online (Sandbox Code Playgroud)
ic_launcher_单色
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<!-- PATH DATA -->
</vector>
Run Code Online (Sandbox Code Playgroud)
为什么主题版本会放大?如何解决此问题?
icons android android-icons android-vectordrawable android-13
我为我的应用程序设置了 FCM。它非常适合运行 Android 11 及更低版本的设备。但对于 Android 12 及更高版本的设备,我无法通过使用接收令牌
FirebaseMessaging.getInstance().token.addOnCompleteListener {
...
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED而不是令牌
显现
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.boltic28.learnmultiplying">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LearnMultiplying"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".services.firebase.AppFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
应用程序:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.boltic28.learnmultiplying" …Run Code Online (Sandbox Code Playgroud) firebase firebase-authentication firebase-cloud-messaging android-12 android-13
我一直在尝试向我的应用程序添加启动画面,但我尝试过的每个配置都没有产生良好的结果。
这是我尝试过的最后一次也是最简单的尝试。我正在运行 Android 13 的三星 Galaxy S21 FE 上进行测试。我还在运行 Android 13 的 Pixel 6 上使用 Android Studio 模拟器进行了测试,结果相同。我使用运行 Android 11 的 Nexus 5X 模拟器进行测试,没有出现两种尺寸图像问题。我用来flutter_native_splash: ^2.2.18生成启动画面。这是我的 flutter_native_splash.yaml 配置:
flutter_native_splash:
color: "#eeeeee"
image: assets/launcher/launcher.png
android_12:
image: assets/launcher/launcher_android_12.png
color: "#eeeeee"
web: false
Run Code Online (Sandbox Code Playgroud)
这是两张图片。
launcher_android_12.png
启动器.png
我尝试在常规配置和 android_12 配置上使用这两个图像,但它们都没有产生更好的结果。我希望看到一个连续的闪屏,而不是一个大图像后面跟着一个较小的图像。
每次执行应用程序时,我都会收到“startForeground 的错误通知”错误
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.pennskanvtic, PID: 17447
android.app.RemoteServiceException$CannotPostForegroundServiceNotificationException:
Bad notification for startForeground
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1978)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2237)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)`
Run Code Online (Sandbox Code Playgroud)
我的服务仅启动计时器并显示通知(我尝试在NotificationCompat.Builder中使用setChannelId而不进行任何更改):
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.pennskanvtic, PID: 17447
android.app.RemoteServiceException$CannotPostForegroundServiceNotificationException:
Bad notification for startForeground
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1978)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2237)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)`
Run Code Online (Sandbox Code Playgroud)
我的 MainActivity 在 onStart() 内请求许可:
public class …Run Code Online (Sandbox Code Playgroud) 有一个关于使用 ADB 命令获取 IMEI 号码 Android 12 的问题。
adb root
adb shell "service call iphonesubinfo 1 i64 0 | cut -c 52-66 | tr -d '.[:space:]'"
Run Code Online (Sandbox Code Playgroud)
我测试了该方法,在Android 12上运行良好。
但从android 13开始,它只是返回一条错误消息:“Package does not属于...”
有人可以帮忙吗?谢谢!
我正在开发一个需要 Android 设备上的存储访问权限的 Flutter 应用程序。该应用程序在 Android 12 版本之前可以正常运行,但我在 Android 13 设备上遇到了存储权限问题。我遵循请求存储权限的标准实现,并在应用程序的 AndroidManifest.xml 文件中包含必要的权限声明。但是,在 Android 13 设备上,应用程序无法访问外部存储并遇到权限错误。
I/ViewRootImpl@f9221bd[MainActivity](25559): handleAppVisibility mAppVisible = true visible = false
I/SurfaceView@31e8ae4(25559): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{31e8ae4 V.E...... ........ 0,0-720,1570} of ViewRootImpl@f9221bd[MainActivity]
I/SurfaceView@31e8ae4(25559): Changes: creating=false format=false size=false visible=true alpha=false hint=false mUseAlpha=false visible=true left=false top=false
I/SurfaceView@31e8ae4(25559): 52333284 Cur surface: Surface(name=null)/@0xfd2426a
I/SurfaceView@31e8ae4(25559): applyTransactionOnVriDraw: vri = ViewRootImpl@f9221bd[MainActivity] fRS = false t = 0xb40000709aa32400 android.view.SurfaceView.performSurfaceTransaction:959 android.view.SurfaceView.updateSurface:1105 android.view.SurfaceView.onWindowVisibilityChanged:371
I/ViewRootImpl@f9221bd[MainActivity](25559): applyTransactionOnDraw: mRemoved = false isHardwareEnabled = true t = 0xb40000709aa32400android.view.SurfaceView.applyTransactionOnVriDraw:2048 android.view.SurfaceView.performSurfaceTransaction:959 android.view.SurfaceView.updateSurface:1105 android.view.SurfaceView.onWindowVisibilityChanged:371 android.view.View.dispatchWindowVisibilityChanged:15943 …Run Code Online (Sandbox Code Playgroud)