Menu item in pink in Android 8 in App developed for Android 23 based devices

lpinholpinho USMember ✭✭

Hi,
I'm working on an application that is being design to work with devices that have Android 6 (23) but that can work on more modern devices.
I cannot update the target device to a newer version of Android, so, I'm stuck with it.
I've create a new Xamarin.Android application with target sdk set to 23.

When I open the application in my Android 6 device, it works without any problem, if I open this application in an Android 8 device my menu have their text color in pink:

I've read about this problem and most people say to compile it with a newer version, but for me, that's not a solution because the target devices is stuck in Android 6.

I can see this error that might be related to this problem, the problem is, how to fix it?

02-25 17:53:19.266 D/HwGalleryCacheManagerImpl(15676): mIsEffect:false 02-25 17:53:19.295 W/Resources(15676): ColorStateList android:color/text_color_secondary has unresolved theme attributes! Consider using Resources.getColorStateList(int, Theme) or Context.getColorStateList(int). 02-25 17:53:19.295 W/Resources(15676): java.lang.RuntimeException 02-25 17:53:19.295 W/Resources(15676): at android.content.res.Resources.getColorStateList(Resources.java:1141) 02-25 17:53:19.295 W/Resources(15676): at android.support.design.widget.NavigationView.createDefaultColorStateList(NavigationView.java:415) 02-25 17:53:19.295 W/Resources(15676): at android.support.design.widget.NavigationView.<init>(NavigationView.java:126) 02-25 17:53:19.295 W/Resources(15676): at android.support.design.widget.NavigationView.<init>(NavigationView.java:95) 02-25 17:53:19.295 W/Resources(15676): at java.lang.reflect.Constructor.newInstance0(Native Method) 02-25 17:53:19.295 W/Resources(15676): at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.createView(LayoutInflater.java:658) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.rInflate(LayoutInflater.java:874) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 02-25 17:53:19.295 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 02-25 17:53:19.295 W/Resources(15676): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 02-25 17:53:19.295 W/Resources(15676): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 02-25 17:53:19.295 W/Resources(15676): at md5c68d5b0b5ecc239dd9b6ed039bb19419.MainActivity.n_onCreate(Native Method) 02-25 17:53:19.295 W/Resources(15676): at md5c68d5b0b5ecc239dd9b6ed039bb19419.MainActivity.onCreate(MainActivity.java:34) 02-25 17:53:19.295 W/Resources(15676): at android.app.Activity.performCreate(Activity.java:7372) 02-25 17:53:19.295 W/Resources(15676): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218) 02-25 17:53:19.295 W/Resources(15676): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147) 02-25 17:53:19.295 W/Resources(15676): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302) 02-25 17:53:19.295 W/Resources(15676): at android.app.ActivityThread.-wrap12(Unknown Source:0) 02-25 17:53:19.295 W/Resources(15676): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891) 02-25 17:53:19.295 W/Resources(15676): at android.os.Handler.dispatchMessage(Handler.java:108) 02-25 17:53:19.295 W/Resources(15676): at android.os.Looper.loop(Looper.java:166) 02-25 17:53:19.295 W/Resources(15676): at android.app.ActivityThread.main(ActivityThread.java:7425) 02-25 17:53:19.295 W/Resources(15676): at java.lang.reflect.Method.invoke(Native Method) 02-25 17:53:19.295 W/Resources(15676): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 02-25 17:53:19.295 W/Resources(15676): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 02-25 17:53:19.298 W/Resources(15676): ColorStateList android:color/text_color_primary has unresolved theme attributes! Consider using Resources.getColorStateList(int, Theme) or Context.getColorStateList(int). 02-25 17:53:19.298 W/Resources(15676): java.lang.RuntimeException 02-25 17:53:19.298 W/Resources(15676): at android.content.res.Resources.getColorStateList(Resources.java:1141) 02-25 17:53:19.298 W/Resources(15676): at android.support.design.widget.NavigationView.createDefaultColorStateList(NavigationView.java:415) 02-25 17:53:19.298 W/Resources(15676): at android.support.design.widget.NavigationView.<init>(NavigationView.java:143) 02-25 17:53:19.298 W/Resources(15676): at android.support.design.widget.NavigationView.<init>(NavigationView.java:95) 02-25 17:53:19.298 W/Resources(15676): at java.lang.reflect.Constructor.newInstance0(Native Method) 02-25 17:53:19.298 W/Resources(15676): at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.createView(LayoutInflater.java:658) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.rInflate(LayoutInflater.java:874) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 02-25 17:53:19.298 W/Resources(15676): at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 02-25 17:53:19.298 W/Resources(15676): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 02-25 17:53:19.298 W/Resources(15676): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 02-25 17:53:19.298 W/Resources(15676): at md5c68d5b0b5ecc239dd9b6ed039bb19419.MainActivity.n_onCreate(Native Method) 02-25 17:53:19.298 W/Resources(15676): at md5c68d5b0b5ecc239dd9b6ed039bb19419.MainActivity.onCreate(MainActivity.java:34) 02-25 17:53:19.298 W/Resources(15676): at android.app.Activity.performCreate(Activity.java:7372) 02-25 17:53:19.298 W/Resources(15676): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218) 02-25 17:53:19.298 W/Resources(15676): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147) 02-25 17:53:19.298 W/Resources(15676): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302) 02-25 17:53:19.298 W/Resources(15676): at android.app.ActivityThread.-wrap12(Unknown Source:0) 02-25 17:53:19.298 W/Resources(15676): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891) 02-25 17:53:19.298 W/Resources(15676): at android.os.Handler.dispatchMessage(Handler.java:108) 02-25 17:53:19.298 W/Resources(15676): at android.os.Looper.loop(Looper.java:166) 02-25 17:53:19.298 W/Resources(15676): at android.app.ActivityThread.main(ActivityThread.java:7425) 02-25 17:53:19.298 W/Resources(15676): at java.lang.reflect.Method.invoke(Native Method) 02-25 17:53:19.298 W/Resources(15676): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 02-25 17:53:19.298 W/Resources(15676): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

Sorry if this is a newbie question and thanks for your help.

Best Regards,
LP

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Why are you set the target sdk set to the newer version(eg. android 8.1 or Android 9.0), meanwhile set the Minimum Android version to Android 6 or below version as follows?
    Since the app could run on Android 6, and compatible with Android 6.0.

  • lpinholpinho USMember ✭✭

    Hi jezh,

    thanks for the reply.
    Tried that, it didn't worked :(

    Thanks anyway,
    LP

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post a basic demo so that we can test with it?

  • lpinholpinho USMember ✭✭

    Hi Jezh,

    sure, here: https://ufile.io/wrfp9

    It was created using Visual Studio 2017, no changes from me except the required so that it compiles for Marshmallow (removed references to roundIcon that is not supported in android Marshmallow).

    Sorry for te late reply.
    LP

Sign In or Register to comment.