在Visual Studio中进行xamarin更新后,Android 5.1.1棒棒糖的应用程序启动时应用程序启动崩溃

时间:2017-07-13 09:49:22

标签: c# android xamarin xamarin.android android-5.1.1-lollipop

我们之前开发了一个应用程序,用于软糖到牛轧糖,但现在我们在视觉工作室更新我们的xamarin后出现了问题。

之前,我们的apk完全在所有Android版本中运行,但现在更新后,它现在崩溃......但仅限于5.1.1。我们已经用kitkat,棒棒糖5.1,棉花糖和牛轧糖进行了测试,它确实在运行。

我们注意到我们的应用程序在OnCreate方法中的最后一个大括号“}”之后崩溃了。它在没有事先细节的情况下发布了一个例外。

这种例外的原因是什么?或任何解决方案,如果有人已经解决了它。

我不知道它是否只是因为xamarin更新而被更改的设置。

异常仅发生在OPPO手机上,在其他5.1和5.1.1版本上进行了测试

异常图像在这里,正如我所说,没有单一的细节

enter image description here

这是调试器输出

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版本在这里 -Marshmallow和Nougat与Asus 6.0&amp; 7.0
-Kitkat和Marshmallow Starmobile 4.4&amp; 6.0
-JellyBean,Kitkat和Marshmallow与三星4.2,4.4&amp; 6.0
- 其他品牌有5.1和5.1.1(不是OPPO)

1 个答案:

答案 0 :(得分:3)

问题在于你的款式颜色。

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和构建依赖项。

看看这两个问题的答案:

Android XML: RuntimeException: Failed to resolve attribute at index 6

TextInputLayout: RuntimeException - Failed to resolve attribute at index 24

RuntimeException while using new TextInputLayout from support design library