visual studio 中的 xamarin 更新后,使用 Android 5.1.1 lollipop 启动应用时应用启动崩溃

App launch is crashing on app launch with Android 5.1.1 lollipop after xamarin update in visual studio

我们之前为软糖到牛轧糖开发了一个应用程序,但现在我们在 visual studio.

中更新我们的 xamarin 后遇到了问题

之前,我们的 apk 在所有 Android 版本中都是完美的 运行,但现在更新后,它正在崩溃...但仅在 5.1.1 中。我们已经用 kitkat、lollipop 5.1、marshmallow 和 nougat 对其进行了测试,它确实 运行.

我们注意到我们的应用程序在 OnCreate 方法中的最后一个大括号“}”后崩溃。它正在启动一个没有事先详细信息的异常。

出现此异常的原因可能是什么?或者任何解决方案,如果有人已经解决了它。

不知道是不是因为xamarin更新而改变了设置。

仅在 OPPO phone 上出现异常,已在其他 5.1 和 5.1.1 版本上进行测试

这里有例外图片,正如我所说,没有任何细节

这是调试器输出

Android application is debugging.  
Mono Warning: option gen-compact-seq-points is deprecated.  
07-14 10:37:16.613 W/monodroid(18119): Trying to load sgen from: /data/app/RBOS_2.x_0.x_1.RBOS_2.x_0.x_1-1/lib/arm/libmonosgen-2.0.so
07-14 10:37:16.613 W/monodroid-debug(18119): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:29342,server=y,embedding=1  
07-14 10:37:16.953 W/monodroid-debug(18119): Accepted stdout connection: 29  
07-14 10:37:18.793 W/monodroid-gc(18119): GREF GC Threshold: 46080  
07-14 10:37:18.793 W/monodroid(18119): Calling into managed runtime init  
Loaded assembly: RBOS 2.0.1.dll  
Loaded assembly: BusinessLogic.dll  
Loaded assembly: BusinessObject.dll  
Loaded assembly: DotNetCross.Memory.Unsafe.dll [External]  
Loaded assembly: Newtonsoft.Json.dll [External]  
Loaded assembly: Realm.dll [External]  
Loaded assembly: Remotion.Linq.dll [External]  
Loaded assembly: Xamarin.Android.Support.Animated.Vector.Drawable.dll [External]  
Loaded assembly: Xamarin.Android.Support.Design.dll [External]  
Loaded assembly: Xamarin.Android.Support.v4.dll [External]  
Loaded assembly: Xamarin.Android.Support.v7.AppCompat.dll [External]  
Loaded assembly: Xamarin.Android.Support.v7.CardView.dll [External]  
Loaded assembly: Xamarin.Android.Support.v7.RecyclerView.dll [External]  
Loaded assembly: Xamarin.Android.Support.Vector.Drawable.dll [External]  
Loaded assembly: UTILITIES.dll  
Loaded assembly: Mono.Android.dll [External]  
Loaded assembly: Java.Interop.dll [External]  
Loaded assembly: System.Core.dll [External]  
Loaded assembly: MonoDroidConstructors [External]  
Loaded assembly: System.dll [External]  
Loaded assembly: System.Data.dll [External]  
Loaded assembly: System.Xml.dll [External]  
07-14 10:37:20.183 D/OpenGLRenderer(18119): Use EGL_SWAP_BEHAVIOR_PRESERVED: true  
07-14 10:37:20.193 D/Atlas   (18119): Validating map...  
07-14 10:37:20.303 W/ResourceType(18119): Too many attribute references, stopped at: 0x01010099  
07-14 10:37:20.303 W/ResourceType(18119): Too many attribute references, stopped at: 0x0101009b  
07-14 10:37:20.313 I/TextInputLayout(18119): EditText added is not a TextInputEditText. Please switch to using that class instead.  
Loaded assembly: System.Web.Services.dll [External]  
Loaded assembly: Mono.Security.dll [External]  
07-14 10:37:20.903 I/Adreno-EGL(18119): <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build:   
AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092_msm8916_64_refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092__release_AU (I6eddbfa548)  
07-14 10:37:20.903 I/Adreno-EGL(18119): OpenGL ES Shader Compiler Version: E031.25.03.04  
07-14 10:37:20.903 I/Adreno-EGL(18119): Build Date: 09/16/15 Wed  
07-14 10:37:20.903 I/Adreno-EGL(18119): Local Branch:   
07-14 10:37:20.903 I/Adreno-EGL(18119): Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092  
07-14 10:37:20.903 I/Adreno-EGL(18119): Local Patches: NONE    
07-14 10:37:20.903 I/Adreno-EGL(18119): Reconstruct Branch: NOTHING  
07-14 10:37:20.903 I/OpenGLRenderer(18119): Initialized EGL, version 1.4  
07-14 10:37:20.923 D/OpenGLRenderer(18119): Enabling debug mode 0  
07-14 10:37:20.963 W/ResourceType(18119): Too many attribute references, stopped at: 0x01010099  
07-14 10:37:20.963 W/ResourceType(18119): Too many attribute references, stopped at: 0x0101009b  
07-14 10:37:20.963 D/AndroidRuntime(18119): Shutting down VM  
An unhandled exception occured.  

示例如下

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    SetContentView(Resource.Layout.RequestAccess);

    #region Check if there is an active user - proceed to login, else proceed to request access
    UserAccountLogic.getAllUserAccountsFromDatabase(listUserObject);

    if (listUserObject.Count > 0 && listUserObject[0].isActive!=0)
    {
        //Call LoginActivity
        var intent = new Intent(this, typeof(Login));
        StartActivity(intent);
        FinishAffinity();
    }
    else
    {
        txtAccessCode = FindViewById<TextInputLayout>(Resource.Id.layoutAccessCode);

        button = FindViewById<Button>(Resource.Id.btnSend);

        button.Click += delegate { sendButtonClicked(); };
    }
    #endregion
    Android.Util.Log.Error("L", "Error Occured");
}//this is the place where exception occur in 5.1.1 . I don't know why.

如果有用户并且处于活动状态。它将继续登录。但同样的事情会发生。将在 OnCreate() 方法

下 login.cs 的最后一个括号再次崩溃

这是 LogCat 的输出,对我来说很难阅读,因为这是我第一次看到它。

E/L       ( 6824): Error Occured // I added a log tag here before the bracket
V/WindowManager(  866): Adding window Window{386088e1 u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess} at 7 of 14 (before Window{3031e02c u0 Starting RBOS_2.x_0.x_1.RBOS_2.x_0.x_1})
V/WindowManager(  866): Changing focus from null to Window{386088e1 u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess} Callers=com.android.server.wm.WindowManagerService.relayoutWindow:3410 com.android.server.wm.Session.relayout:202 android.view.IWindowSession$Stub.onTransact:273 com.android.server.wm.Session.onTransact:130
I/Adreno-EGL( 6824): <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092_msm8916_64_refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092__release_AU (I6eddbfa548)
I/Adreno-EGL( 6824): OpenGL ES Shader Compiler Version: E031.25.03.04
I/Adreno-EGL( 6824): Build Date: 09/16/15 Wed
I/Adreno-EGL( 6824): Local Branch:
I/Adreno-EGL( 6824): Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.BR.1.1.3.C8.05.01.00.115.092
I/Adreno-EGL( 6824): Local Patches: NONE
I/Adreno-EGL( 6824): Reconstruct Branch: NOTHING
I/OpenGLRenderer( 6824): Initialized EGL, version 1.4
D/OpenGLRenderer( 6824): Enabling debug mode 0
W/ResourceType( 6824): Too many attribute references, stopped at: 0x01010099
W/ResourceType( 6824): Too many attribute references, stopped at: 0x0101009b
D/AndroidRuntime( 6824): Shutting down VM
I/KSO_STAT( 1466): App is in background, stop update end time, ready to start a new session.
V/ExReceiver(32431): revceive action =android.intent.action.BATTERY_CHANGED
E/QCOMSysDaemon( 6861): Can't find/open bootselect node: (No such file or directory)
I/QCOMSysDaemon( 6861): Starting qcom system daemon
E/Diag_Lib( 6861):  Diag_LSM_Init: Failed to open handle to diag driver, error = 2
E/QCOMSysDaemon( 6861):  Diag_LSM_Init failed : 0
I/Babel_ConcService( 5697): Acquired partial wake lock to keep ConcurrentService alive
I/Babel_ConcService( 5697): Released partial wake lock as ConcurrentService became idle
I/KSO_STAT( 1466): App is in background, stop update end time, ready to start a new session.
W/ActivityManager(  866): Launch timeout has expired, giving up wake lock!
V/ExReceiver(32431): revceive action =android.intent.action.BATTERY_CHANGED
D/TelephonyProvider( 1787): simId = 0
D/TelephonyProvider( 1787): simId = 0
D/TelephonyProvider( 1787): query(): mccmnc = 51503 spn = SMART Prepaid simId = 0
D/PhoneInterfaceManager( 1787): [PhoneIntfMgr] getDataEnabled: subId=1 phoneId=0
D/PhoneInterfaceManager( 1787): [PhoneIntfMgr] getDataEnabled: subId=1 retVal=true
E/QCOMSysDaemon( 6864): Can't find/open bootselect node: (No such file or directory)
I/QCOMSysDaemon( 6864): Starting qcom system daemon
E/Diag_Lib( 6864):  Diag_LSM_Init: Failed to open handle to diag driver, error = 2
E/QCOMSysDaemon( 6864):  Diag_LSM_Init failed : 0
E/AndroidRuntime( 6824): FATAL EXCEPTION: main
E/AndroidRuntime( 6824): Process: RBOS_2.x_0.x_1.RBOS_2.x_0.x_1, PID: 6824
E/AndroidRuntime( 6824): android.view.InflateException: Binary XML file line #24: Error inflating class TextView
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
E/AndroidRuntime( 6824):        at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
E/AndroidRuntime( 6824):        at android.widget.OppoCursorController$FloatPanelViewController.<init>(OppoCursorController.java:1382)
E/AndroidRuntime( 6824):        at android.widget.OppoCursorController.createFloatPanelViewController(OppoCursorController.java:122)
E/AndroidRuntime( 6824):        at android.widget.OppoCursorController$InsertionPointCursorController.<init>(OppoCursorController.java:197)
E/AndroidRuntime( 6824):        at android.widget.OppoCursorController.create(OppoCursorController.java:75)
E/AndroidRuntime( 6824):        at android.widget.OppoEditor.getOppoInsertionController(OppoEditor.java:410)
E/AndroidRuntime( 6824):        at android.widget.OppoEditor.onFocusChanged(OppoEditor.java:298)
E/AndroidRuntime( 6824):        at android.widget.TextView.onFocusChanged(TextView.java:8092)
E/AndroidRuntime( 6824):        at android.view.View.handleFocusGainInternal(View.java:4963)
E/AndroidRuntime( 6824):        at android.view.View.requestFocusNoSearch(View.java:7679)
E/AndroidRuntime( 6824):        at android.view.View.requestFocus(View.java:7658)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2612)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2656)
E/AndroidRuntime( 6824):        at android.view.ViewGroup.requestFocus(ViewGroup.java:2615)
E/AndroidRuntime( 6824):        at android.view.View.requestFocus(View.java:7625)
E/AndroidRuntime( 6824):        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2019)
E/AndroidRuntime( 6824):        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1116)
E/AndroidRuntime( 6824):        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6084)
E/AndroidRuntime( 6824):        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
E/AndroidRuntime( 6824):        at android.view.Choreographer.doCallbacks(Choreographer.java:586)
E/AndroidRuntime( 6824):        at android.view.Choreographer.doFrame(Choreographer.java:556)
E/AndroidRuntime( 6824):        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
E/AndroidRuntime( 6824):        at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 6824):        at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 6824):        at android.os.Looper.loop(Looper.java:150)
E/AndroidRuntime( 6824):        at android.app.ActivityThread.main(ActivityThread.java:5408)
E/AndroidRuntime( 6824):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6824):        at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 6824):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
E/AndroidRuntime( 6824):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
E/AndroidRuntime( 6824): Caused by: java.lang.RuntimeException: Failed to resolve attribute at index 24
E/AndroidRuntime( 6824):        at android.content.res.TypedArray.getColor(TypedArray.java:401)
E/AndroidRuntime( 6824):        at android.widget.TextView.<init>(TextView.java:709)
E/AndroidRuntime( 6824):        at android.widget.TextView.<init>(TextView.java:645)
E/AndroidRuntime( 6824):        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
E/AndroidRuntime( 6824):        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
E/AndroidRuntime( 6824):        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
E/AndroidRuntime( 6824):        at android.support.v7.app.AppC
D/ActivityManager(  866): addErrorToDropBox processName = RBOS_2.x_0.x_1.RBOS_2.x_0.x_1
W/ActivityManager(  866):   Force finishing activity 1 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess
W/ActivityManager(  866):   Force finishing activity 2 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.Launcher
W/DropBoxManagerService(  866): Dropping: data_app_crash (10 > 0 bytes)
V/WindowManager(  866): Changing focus from Window{386088e1 u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess} to null Callers=com.android.server.wm.WindowManagerService.setFocusedApp:4259 com.android.server.am.ActivityManagerService.setFocusedActivityLocked:2553 com.android.server.am.ActivityStack.adjustFocusedActivityLocked:2873 com.android.server.am.ActivityStack.finishActivityLocked:3118
D/DropBoxManagerService(  866): file :: /data/system/dropbox/data_app_crash@1501223953398.lost
V/WindowManager(  866): Changing focus from null to Window{18da7c8d u0 Application Error: RBOS_2.x_0.x_1.RBOS_2.x_0.x_1} Callers=com.android.server.wm.WindowManagerService.addWindow:2660 com.android.server.wm.Session.addToDisplay:173 android.view.ViewRootImpl.setView:582 android.view.WindowManagerGlobal.addView:300
D/StatusBarManagerService(  866): manageDisableList userId=0 what=0x0 pkg=Window{18da7c8d u0 Application Error: RBOS_2.x_0.x_1.RBOS_2.x_0.x_1}
W/ActivityManager(  866):  Dismiss app error dialog : RBOS_2.x_0.x_1.RBOS_2.x_0.x_1
V/WindowManager(  866): Changing focus from Window{18da7c8d u0 Application Error: RBOS_2.x_0.x_1.RBOS_2.x_0.x_1} to null Callers=com.android.server.wm.WindowManagerService.removeWindowLocked:2830 com.android.server.wm.WindowManagerService.removeWindowLocked:2739 com.android.server.wm.WindowManagerService.removeWindow:2729 com.android.server.wm.Session.remove:192
I/Process ( 6824): Sending signal. PID: 6824 SIG: 9
V/Process ( 6824): killProcess [6824] Callers=com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException:99 android.runtime.UncaughtExceptionHandler.n_uncaughtException:-2 android.runtime.UncaughtExceptionHandler.uncaughtException:37 java.lang.ThreadGroup.uncaughtException:693
I/WindowState(  866): WIN DEATH: Window{2ec5203a u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.Launcher}
I/WindowState(  866): WIN DEATH: Window{386088e1 u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess}
D/WindowStateAnimator(  866): finishExit add win to mPendingRemove. win:Window{386088e1 u0 RBOS_2.x_0.x_1.RBOS_2.x_0.x_1/md53392bfeb2a49aa0a04b6510289d0206f.RequestAccess}
I/ActivityManager(  866): Process RBOS_2.x_0.x_1.RBOS_2.x_0.x_1 (pid 6824) has died
V/WindowManager(  866): Changing focus from null to Window{8939001 u0 com.android.settings/com.android.settings.SubSettings} Callers=com.android.server.wm.WindowManagerService.relayoutWindow:3410 com.android.server.wm.Session.relayout:202 android.view.IWindowSession$Stub.onTransact:273 com.android.server.wm.Session.onTransact:130
D/StatusBarManagerService(  866): manageDisableList userId=0 what=0x0 pkg=Window{8939001 u0 com.android.settings/com.android.settings.SubSettings}
W/InputMethodManagerService(  866): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@29eee4cb attribute=null, token = android.os.BinderProxy@129961e8
D/AndroidRuntime( 6867): >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
D/AndroidRuntime( 6867): CheckJNI is OFF
E/jniPro  ( 6867): protecteyesinit, try to dlopen arm32 so:/system/lib/libprotecteyes.so
E/jniPro  ( 6867): protecteyesinit, dlopen arm32 so:/system/lib/libprotecteyes.so, open ***success****, now dlerror info: (null)
D/AndroidRuntime( 6867): Calling main entry com.android.commands.am.Am
D/ActivityManager(  866): for debug: forceStopPackage[pkg:RBOS_2.x_0.x_1.RBOS_2.x_0.x_1,userId:-1], caller[pid:6867,uid:2000]
I/ActivityManager(  866): Force stopping RBOS_2.x_0.x_1.RBOS_2.x_0.x_1 appid=10189 user=0: from pid 6867
D/AndroidRuntime( 6867): Shutting down VM
I/KSO_STAT( 1466): App is in background, stop update end time, ready to start a new session.
E/QCOMSysDaemon( 6886): Can't find/open bootselect node: (No such file or directory)
I/QCOMSysDaemon( 6886): Starting qcom system daemon
E/Diag_Lib( 6886):  Diag_LSM_Init: Failed to open handle to diag driver, error = 2
E/QCOMSysDaemon( 6886):  Diag_LSM_Init failed : 0
D/TaskPersister(  866): removeObsoleteFile: deleting file=354_task.xml

** 更新 XML 和风格 **

这是我的 XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:alpha="0.9"
  android:background="@drawable/rbos_2"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:weightSum="100">
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_weight="55"
      android:gravity="center"
      android:layout_height="match_parent"
      android:orientation="vertical">
    <ImageView
      android:src="@drawable/dtglogo3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:id="@+id/imgLogo" />
  </LinearLayout>
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_weight="45"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:gravity="top"
      android:paddingLeft="25dp"
      android:paddingRight="25dp">
    <android.support.design.widget.TextInputLayout
        android:id="@+id/layoutAccessCode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/TextLabel"
        android:background="@android:color/transparent"
        android:layout_marginTop="15dp">
        <!--android:background="@drawable/layouttextbox"-->
      <EditText
          android:id="@+id/txtAccessCode"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:layout_marginTop="15dp"
          android:layout_marginBottom="5dp"
          android:maxLength="15"
          android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr‌​stuvwxyz0123456789"
          android:fontFamily="@string/fontFamily"
          android:inputType="textVisiblePassword|textNoSuggestions"
          android:imeOptions="actionDone"
          android:singleLine="true"
          android:hint="Access Code" />
    </android.support.design.widget.TextInputLayout>
    <Button
        android:id="@+id/btnSend"
        android:textAllCaps="false"
        android:theme="@style/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Send"
        android:layout_marginTop="15dp"
        android:fontFamily="@string/fontFamily"
        android:textSize="20dp"
        android:textColor="#e4ecd4"
        android:background="@drawable/layoutbutton"/>
  </LinearLayout>
  <TextView
    android:text="@string/versionName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:textSize="6dp"
    android:gravity="right"
    android:padding="5dp"
    android:textColor="#0d47a1"/>
</LinearLayout>

这是我以前的风格

<!-- Input Layout -->
<style name="TextLabel" parent="TextAppearance.AppCompat">
  <!-- Hint color and label color in FALSE state -->
  <item name="android:textColorHint">#000000</item>
  <item name="android:textSize">16sp</item>
  <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
  <item name="colorAccent">#0d47a1</item>
  <item name="colorControlNormal">#000000</item>
  <item name="colorControlActivated">#0d47a1</item>
</style>

** 问题已解决 **

按照建议,我可能需要将样式的父项从 TextAppearance.AppCompat 更改为 Widget.Design.TextInputLayout 。我试过了,成功了!
非常感谢!

*仅供其他编码员测试之用
只是,我想知道为什么只在 OPPO 5.1.1 中。我试过和工作的其他 android 版本在这里
-棉花糖和牛轧糖与华硕 6.0 和 7.0
-Kitkat 和 Marshmallow Starmobile 4.4 & 6.0
-JellyBean、Kitkat 和 Marshmallow 与三星 4.2、4.4 和 6.0
- 5.1 和 5.1.1 的其他品牌(不是 OPPO)

问题出在您的样式颜色上。

E/AndroidRuntime( 6824): android.view.InflateException: Binary XML file line #24: Error inflating class TextView

.../...

Caused by: java.lang.RuntimeException: Failed to resolve attribute at index 24
E/AndroidRuntime( 6824): at android.content.res.TypedArray.getColor(TypedArray.java:401)

如果来自这里,我假设:

txtAccessCode = FindViewById<TextInputLayout>(Resource.Id.layoutAccessCode);

没有看到你的风格,你可以尝试这样的事情:

For example 确保 TextView 继承自 Widget.Design.TextInputLayout

<style name="TextViewStyle" parent="Widget.Design.TextInputLayout">

并且您已经包含了 Design Support Library 依赖项。

如果您想要更具体的答案,请添加您的样式代码、xml/layout、layoutAccessCode 和构建依赖项。

看这两个问题的答案:

TextInputLayout: RuntimeException - Failed to resolve attribute at index 24

RuntimeException while using new TextInputLayout from support design library