本文介绍了白日梦的设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为创建设置我的白日梦,并根据该文件,我需要创建一个XML文件,如下所示:

 <梦想的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:settingsActivity =com.example.app / .MyDreamSettingsActivity/>
 

不过,我的活动是一个库项目(称为com.project.base)和我一直在的logcat 上的设置按钮,点击时:

  11-16 23:01:29.331:E / AndroidRuntime(28908):android.content.ActivityNotFoundException:无法找到明确的活动类{com.project.base / com.project .base.SettingsDayDream};有你宣布你的Andr​​oidManifest.xml这个活动?
 

我有我的XML文件中的设置是这样的:

 <梦想的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:settingsActivity =com.project.base / .SettingsDayDream/>
 

但我已经尝试了所有的变化,如 com.project.base / com.project.base.SettingsDayDream 和公正的 com.project.base.SettingsDayDream ,但似乎没有任何工作。

我已经声明在活动的Andr​​oidManifest.xml 是这样的:

 <活动机器人:名称=com.project.base.SettingsDayDream机器人:configChanges =keyboardHidden |定位/>
 

以及该服务:

 <服务机器人:名称=com.project.base.DayDream机器人:出口=真正的机器人:图标=@可绘制/图标机器人:标签= @字符串/ APP_NAME>
    <意向滤光器>
    <作用机器人:名称=android.service.dreams.DreamService/>
        <类机器人:名称=android.intent.category.DEFAULT/>
    &所述; /意图滤光器>
    <元数据的android:NAME =android.service.dream安卓资源=@ XML /白日梦/>
< /服务>
 

解决方案

现在的问题是在你的 daydream.xml 。为 Android上的格式:settingsActivity current.app.package / com.project.base.SettingsActivity

所以 current.app.package ,在 / ,必须是你目前的应用程序,而不是库项目。

I'm trying to create a settings for my Daydream and according to the documentation, I need to create a xml file, like this:

 <dream xmlns:android="http://schemas.android.com/apk/res/android"
 android:settingsActivity="com.example.app/.MyDreamSettingsActivity" />

However, my Activity is in a library project (called com.project.base) and I keep getting this error in Logcat when clicking on the setting button:

 11-16 23:01:29.331: E/AndroidRuntime(28908): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.project.base/com.project.base.SettingsDayDream}; have you declared this activity in your AndroidManifest.xml?

I have my xml file setup like this:

 <dream xmlns:android="http://schemas.android.com/apk/res/android"
 android:settingsActivity="com.project.base/.SettingsDayDream" />

but I've tried all variation, such as com.project.base/com.project.base.SettingsDayDreamand just com.project.base.SettingsDayDream, but nothing seems to work.

I've declared the activity in the AndroidManifest.xml like this:

    <activity android:name="com.project.base.SettingsDayDream" android:configChanges="keyboardHidden|orientation" />

as well as the service:

<service android:name="com.project.base.DayDream" android:exported="true" android:icon="@drawable/icon" android:label="@string/app_name">
    <intent-filter>
    <action android:name="android.service.dreams.DreamService" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    <meta-data android:name="android.service.dream" android:resource="@xml/daydream" />
</service>
解决方案

The problem is in your daydream.xml. The format for the android:settingsActivity is current.app.package/com.project.base.SettingsActivity

So current.app.package, before the /, needs to be your current app, not the library project.

这篇关于白日梦的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 09:07