Java – E / motionrecognition Manager: mscontextservice caused the application to crash on my Android phone

Here is a similar problem: motion recognition manager and motion service in Android

I asked me because there was a comment requesting the code where the error occurred and didn't provide the code. This is my first question, so I hope I didn't do anything wrong or rude

I am developing an application that parses RSS feeds and has settings that users can change, such as background color, text color, user name. These settings are saved in sharing preferences

The application runs perfectly in the simulator. In previous iterations, I was able to run the application on my personal Samsung Galaxy S6 phone before I added the sharing preferences feature. Now, it won't run on my phone

I display feeds in listview. Settings change from listpreferences

My logcat looks like this:

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.

And a code example, one of listpreferences:

In 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" />

In 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>

In the event:

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);
    }

XML for and textviews:

<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"/>

When I first run the application, I put it elsewhere as the default setting, and nothing in the sharing preferences is saved. I'm not sure if it's necessary, but when the application crashed on my phone, I added it and thought it crashed because there were no stored settings

The application was installed on my phone and crashed immediately. I tried to see its settings, but nothing changed. I've tried to uninstall and reinstall the application. Again, it doesn't work on my phone, but it works perfectly on the simulator

Can anyone provide advice to help my app run on my phone? Thank you.

resolvent:

"1" in the color seems to = prefs.getstring ("color", "1"); Is not a valid color value (the supported formats are: #rrggbb #aarrggbb or one of the following names: 'Red', 'Blue', 'green', 'Black', 'white', 'green', 'cyan', 'magenta', 'yellow', 'lightgray', 'DarkGray', 'green', 'lightgreen', 'Aqua', 'Fuchsia', 'Lime', 'maroon', 'Navy', 'Olive', 'Purple', 'Silver', 'cyan) ’) look at official documentation

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>