gpt4 book ai didi

android - 应用崩溃错误 Requires com.android.launcher3.permission.WRITE_SETTINGS, or grantUriPermission

转载 作者:太空狗 更新时间:2023-10-29 14:09:42 27 4
gpt4 key购买 nike

你好,我正在开发一个基于 launcher3 形式 ASOP 的启动器,它只在我所有没有运行 cyanogenmod 的设备上运行,当我尝试将它安装在运行 cyanogenmod 的设备上时,它会加载一分钟然后崩溃

这是 logcat 的内容:

05-03 10:32:26.665: E/AndroidRuntime(9845): FATAL EXCEPTION: launcher-loader
05-03 10:32:26.665: E/AndroidRuntime(9845): Process: com.d4a.tobiasnow, PID: 9845
05-03 10:32:26.665: E/AndroidRuntime(9845): java.lang.SecurityException: Permission Denial: writing com.android.launcher3.LauncherProvider uri content://com.android.launcher3.settings/favorites/18?notify=false from pid=9845, uid=10093 requires com.android.launcher3.permission.WRITE_SETTINGS, or grantUriPermission()
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.os.Parcel.readException(Parcel.java:1546)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.content.ContentProviderProxy.update(ContentProviderNative.java:568)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.content.ContentResolver.update(ContentResolver.java:1333)
05-03 10:32:26.665: E/AndroidRuntime(9845): at com.d4a.tobaisnow.LauncherModel$5.run(LauncherModel.java:526)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.os.Handler.handleCallback(Handler.java:739)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.os.Handler.dispatchMessage(Handler.java:95)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.os.Looper.loop(Looper.java:135)
05-03 10:32:26.665: E/AndroidRuntime(9845): at android.os.HandlerThread.run(HandlerThread.java:61)

我认为这是我项目 list 文件中的一个问题

所以这是我的 list 代码:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.d4a.tobiasnow"
android:versionCode="2"
android:versionName="1.1" >

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />

<permission
android:name="com.android.launcher3.permission.PRELOAD_WORKSPACE"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="system|signature" />
<permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
android:description="@string/permdesc_install_shortcut"
android:label="@string/permlab_install_shortcut"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous" />
<permission
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
android:description="@string/permdesc_uninstall_shortcut"
android:label="@string/permlab_uninstall_shortcut"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous" />
<permission
android:name="com.d4a.tobiasnow.permission.READ_SETTINGS"
android:description="@string/permdesc_read_settings"
android:label="@string/permlab_read_settings"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="normal" />
<permission
android:name="com.d4a.tobiasnow.permission.WRITE_SETTINGS"
android:description="@string/permdesc_write_settings"
android:label="@string/permlab_write_settings"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="normal" />
<permission
android:name="com.d4a.tobiasnow.permission.RECEIVE_LAUNCH_BROADCASTS"
android:protectionLevel="signature" />

<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
<uses-permission android:name="com.android.launcher3.permission.RECEIVE_LAUNCH_BROADCASTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


<application
android:name="com.d4a.tobaisnow.LauncherApplication"
android:hardwareAccelerated="true"
android:configChanges="orientation"
android:icon="@mipmap/ic_launcher_home"
android:label="@string/application_name"
android:largeHeap="@bool/config_largeHeap"
android:supportsRtl="true" >
<activity
android:name="com.d4a.tobaisnow.Launcher"
android:clearTaskOnLaunch="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
android:theme="@style/Theme"
android:windowSoftInputMode="adjustPan" >

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
</activity>
<activity
android:name="com.d4a.tobaisnow.ToggleWeightWatcher"
android:enabled="@bool/debug_memory_enabled"
android:icon="@mipmap/ic_launcher_home"
android:label="@string/toggle_weight_watcher"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="dialer2.DialerActivity"
android:screenOrientation="portrait">
</activity>

<activity android:name="dialer2.FragmentTab3"
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.d4a.tobaisnow.WallpaperPickerActivity"
android:finishOnCloseSystemDialogs="true"
android:icon="@mipmap/ic_launcher_wallpaper"
android:label="@string/pick_wallpaper"
android:process=":wallpaper_chooser"
android:theme="@style/Theme.WallpaperCropper"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<activity
android:name="com.d4a.tobaisnow.WallpaperCropActivity"
android:finishOnCloseSystemDialogs="true"
android:icon="@mipmap/ic_launcher_wallpaper"
android:label="@string/crop_wallpaper"
android:process=":wallpaper_chooser"
android:theme="@style/Theme.WallpaperCropper"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.service.wallpaper.CROP_AND_SET_WALLPAPER" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="image/*" />
</intent-filter>
</activity>

<!-- Debugging tools -->
<activity
android:name="com.d4a.tobaisnow.MemoryDumpActivity"
android:enabled="@bool/debug_memory_enabled"
android:excludeFromRecents="true"
android:icon="@mipmap/ic_launcher_home"
android:label="@string/debug_memory_activity"
android:theme="@android:style/Theme.NoDisplay"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service
android:name="com.d4a.tobaisnow.MemoryTracker"
android:enabled="@bool/debug_memory_enabled" >
</service>

<!-- Intent received used to prepopulate the default workspace. -->
<receiver
android:name="com.d4a.tobaisnow.PreloadReceiver"
android:permission="com.android.launcher3.permission.PRELOAD_WORKSPACE" >
<intent-filter>
<action android:name="com.android.launcher3.action.PRELOAD_WORKSPACE" />
</intent-filter>
</receiver>

<!-- Intent received used to install shortcuts from other applications -->
<receiver
android:name="com.d4a.tobaisnow.InstallShortcutReceiver"
android:permission="com.android.launcher3.permission.INSTALL_SHORTCUT" >
<intent-filter>
<action android:name="com.android.launcher3.action.INSTALL_SHORTCUT" />
</intent-filter>
</receiver>

<!-- Intent received used to uninstall shortcuts from other applications -->
<receiver
android:name="com.d4a.tobaisnow.UninstallShortcutReceiver"
android:permission="com.android.launcher3.permission.UNINSTALL_SHORTCUT" >
<intent-filter>
<action android:name="com.android.launcher3.action.UNINSTALL_SHORTCUT" />
</intent-filter>
</receiver>

<!-- New user initialization; set up initial wallpaper -->
<receiver
android:name="com.d4a.tobaisnow.UserInitializeReceiver"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.USER_INITIALIZE" />
</intent-filter>
</receiver>
<receiver android:name="com.d4a.tobaisnow.PackageChangedReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />

<data android:scheme="package" >
</data>
</intent-filter>
</receiver>

<!-- The settings provider contains Home's data, like the workspace favorites -->
<provider
android:name="com.d4a.tobaisnow.LauncherProvider"
android:authorities="com.d4a.tobiasnow.settings"
android:exported="true"
android:readPermission="com.d4a.tobiasnow.permission.READ_SETTINGS"
android:writePermission="com.d4a.tobiasnow.permission.WRITE_SETTINGS" />

<meta-data
android:name="android.nfc.disable_beam_default"
android:value="true" />
</application>

</manifest>

我把项目中的com.android.launcher3包重命名为:com.d4a.tobaisnow

我不知道问题出在哪里我已经尝试用谷歌搜索这个问题 5 个小时了,但没有成功

任何帮助/反馈都会很棒!

提前致谢

克里斯

最佳答案

您正在 LauncherModel 中的 Runnable(大概是)第 526 行崩溃。当然,我们真的不知道这段代码是什么,因为您决定不知道提供导致崩溃的代码。

但是,从堆栈跟踪来看,您似乎正在尝试使用 com.android.launcher3.LauncherProvider ContentProvider,它由 com.android.launcher3.permission.WRITE_SETTINGS 权限。在标准的 Launcher3 构建中,that permission is signatureOrSystem .您未通过 Launcher3 应用程序的签名 key 进行签名,并且您的应用程序可能未安装在系统分区上。因此,您不能拥有此权限。

关于android - 应用崩溃错误 Requires com.android.launcher3.permission.WRITE_SETTINGS, or grantUriPermission,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30016466/

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