繁体   English   中英

E / MotionRecognitionManager:mSContextService导致应用程序在我的Android手机上崩溃

[英]E/ MotionRecognitionManager: mSContextService causing app to crash on my android phone

这里存在一个与此类似的问题: Android中的动作识别管理器和动作服务

我问我的是因为有一条评论请求错误发生的代码并且没有提供代码。 这是我的第一个问题,所以我希望我没有做错或粗鲁的事情。

我正在开发一个解析RSS源的应用程序,并具有用户可以更改的设置,如背景颜色,文本颜色,用户名。 这些设置保存在共享首选项中。

该应用程序在模拟器中完美运行。 在之前的迭代中,在我添加共享首选项功能之前,我能够在我的个人三星Galaxy s6手机上运行该应用程序。 现在,它不会在我的手机上运行。

我在ListView显示提要。 设置从ListPreferences更改。

我的logcat看起来像这样:

10/30 10:33:34: Launching app
$ adb push C:\Users\Jennifer\AndroidStudioProjects\RSSAssignment7\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.jennifer.rssassignment7

$ adb shell pm install -r "/data/local/tmp/com.example.jennifer.rssassignment7"
    pkg: /data/local/tmp/com.example.jennifer.rssassignment7
Success


$ adb shell am start -n "com.example.jennifer.rssassignment7/com.example.jennifer.rssassignment7.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 14137 on device samsung-sm_g920w8-1215fc28c4943e05

W/System: ClassLoader referenced unknown path: /data/app/com.example.jennifer.rssassignment7-1/lib/arm64

D/InjectionManager: InjectionManager
D/InjectionManager: fillFeatureStoreMap com.example.jennifer.rssassignment7

I/InjectionManager: Constructor com.example.jennifer.rssassignment7, Feature store :{}
I/InjectionManager: featureStore :{}

W/ResourcesManager: getTopLevelResources: /data/app/com.example.jennifer.rssassignment7-1/base.apk / 1.0 running in com.example.jennifer.rssassignment7 rsrc of package com.example.jennifer.rssassignment7

W/ResourcesManager: getTopLevelResources: /data/app/com.example.jennifer.rssassignment7-1/base.apk / 1.0 running in com.example.jennifer.rssassignment7 rsrc of package com.example.jennifer.rssassignment7

W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable

D/AbsListView: Get MotionRecognitionManager

E/MotionRecognitionManager: mSContextService = android.hardware.scontext.ISContextService$Stub$Proxy@8089b26

E/MotionRecognitionManager: motionService = com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@53d367

E/MotionRecognitionManager: motionService = com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@53d367

Application terminated.

和一个代码示例, ListPreferences

在preferences.xml中:

<ListPreference
    android:title="Choose Your Text Color"
    android:summary="We'll save your choice for next time."
    android:key="color"
    android:defaultValue="#000000"
    android:entries="@array/colorArray"
    android:entryValues="@array/colorValues" />

在array.xml中:

<!--color array-->
<string-array name="colorArray">
    <item>Black - black text is not visible on a black background</item>
    <item>Burgundy</item>
    <item>Green</item>
    <item>Blue</item>
    <item>White - white text is not visible on a white background</item>
</string-array>

<string-array name="colorValues">
    <item>#000000</item>
    <item>#800020</item>
    <item>#3C8D0D</item>
    <item>#7068FF</item>
    <item>#ffffff</item>
</string-array>

在活动中:

public class MainActivity extends AppCompatActivity { ...

    TextView titleView, descriptionView;

    titleView = (TextView) findViewById(R.id.titleView);

    descriptionView = (TextView) findViewById(R.id.descriptionView);

    //get text color and background color from shared preferences
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    color = prefs.getString("color", "1");

    if(!(color == null)) {
        titleView.setTextColor(Color.parseColor(color));
        descriptionView.setTextColor(Color.parseColor(color));
    } else {
        titleView.setTextColor(BLACK);
        descriptionView.setTextColor(BLACK);
    }

和TextViews的xml:

<TextView
    android:layout_width="wrap_content"
    android:id= "@+id/titleView"
    android:layout_height="wrap_content"
    style="@style/CodeFont"
    android:textColor="#000000"/>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id= "@+id/descriptionView"
    style="@style/CodeFont"
    android:layout_below="@+id/linkView"/>

我在第一次运行应用程序时将其作为默认设置放入其他地方,共享首选项中没有任何内容保存。 我不确定它是否有必要,但是当应用程序在我的手机上崩溃时我添加了它,认为它崩溃的原因是没有存储的设置。

该应用程序安装在我的手机上并立即崩溃。 我试着看看它的设置,但是从来没有任何改变。 我已经尝试卸载并重新安装该应用程序。 同样,它不适用于我的手机,但它在模拟器上完美运行。

任何人都可以提供建议,以帮助我的应用程序在我的手机上运行吗? 非常感谢。

color = prefs.getString("color", "1"); "1"似乎color = prefs.getString("color", "1"); 不是有效的颜色值(支持的格式为:#RRGGBB #AARRGGBB或以下名称之一:'red','blue','green','black','white','grey','cyan',' magenta','yellow','lightgray','darkgray','grey','lightgrey','darkgrey','aqua','fuchsia','lime','maroon','navy','olive' ,'紫色','银','青色'。)看一下官方文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM