2016-06-29 20 views
0

Ich habe eine Version Android App, die reibungslos auf einem Nexus 5X unter Android 6.0.1 läuft. und auf einem Samsung 5 mit Android 5.0.RuntimeException beim Klicken auf EditText

jedoch auf anderen Geräten seltsame Ausnahmen steigen, wenn Doppelklick auf lange oder jede EditText klicken.

Dies ist die Spur auf einer Alcatel OneTouch (Android 5.1):

E/AndroidRuntime: FATAL EXCEPTION: main 
            Process: es.solbyte.ociohoteles, PID: 18176 
                android.view.InflateException: Binary XML file line #17: Error inflating class TextView 
                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                 at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3047) 
                 at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2302) 
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3019) 
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3019) 
                 at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3422) 
                 at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3672) 
                 at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3929) 
                 at android.widget.Editor.performLongClick(Editor.java:900) 
                 at android.widget.TextView.performLongClick(TextView.java:9104) 
                 at android.view.View$CheckForLongPress.run(View.java:20236) 
                 at android.os.Handler.handleCallback(Handler.java:815) 
                 at android.os.Handler.dispatchMessage(Handler.java:104) 
                 at android.os.Looper.loop(Looper.java:194) 
                 at android.app.ActivityThread.main(ActivityThread.java:5631) 
                 at java.lang.reflect.Method.invoke(Native Method) 
                 at java.lang.reflect.Method.invoke(Method.java:372) 
                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) 
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
                Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=1570 
                 at android.content.res.StringBlock.get(StringBlock.java:65) 
                 at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458) 
                 at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1003) 
                 at android.content.res.TypedArray.getString(TypedArray.java:188) 
                 at android.widget.TextView.<init>(TextView.java:1042) 
                 at android.widget.TextView.<init>(TextView.java:660) 
                 at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60) 
                 at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56) 
                 at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103) 
                 at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:980) 
                 at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1039) 
                 at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44) 
                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:482)  
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  
                 at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3047)  
                 at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2302)  
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3019)  
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3019)  
                 at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3422)  
                 at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:3672)  
                 at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:3929)  
                 at android.widget.Editor.performLongClick(Editor.java:900)  
                 at android.widget.TextView.performLongClick(TextView.java:9104)  
                 at android.view.View$CheckForLongPress.run(View.java:20236)  
                 at android.os.Handler.handleCallback(Handler.java:815)  
                 at android.os.Handler.dispatchMessage(Handler.java:104)  
                 at android.os.Looper.loop(Looper.java:194)  
                 at android.app.ActivityThread.main(ActivityThread.java:5631)  
                 at java.lang.reflect.Method.invoke(Native Method)  
                 at java.lang.reflect.Method.invoke(Method.java:372)  
                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)  
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)  

Und das ist die Strecke auf eine ZTE Kis II Max (Android 4.4.2):

06-29 16:37:44.361 12852-12852/? E/AndroidRuntime: FATAL EXCEPTION: main 
                Process: es.solbyte.ociohoteles, PID: 12852 
                android.view.InflateException: Binary XML file line #17: Error inflating class TextView 
                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                 at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                 at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:2973) 
                 at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2268) 
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2946) 
                 at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:2946) 
                 at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:3166) 
                 at android.widget.Editor$SelectionModifierCursorController.initHandles(Editor.java:3690) 
                 at android.widget.Editor$SelectionModifierCursorController.show(Editor.java:3661) 
                 at android.widget.Editor$SelectionActionModeCallback.onCreateActionMode(Editor.java:2896) 
                 at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onCreateActionMode(PhoneWindow.java:2811) 
                 at android.support.v7.view.SupportActionModeWrapper$CallbackWrapper.onCreateActionMode(SupportActionModeWrapper.java:155) 
                 at android.support.v7.app.AppCompatDelegateImplV7$ActionModeCallbackWrapperV7.onCreateActionMode(AppCompatDelegateImplV7.java:1742) 
                 at android.support.v7.app.AppCompatDelegateImplV7.startSupportActionModeFromWindow(AppCompatDelegateImplV7.java:802) 
                 at android.support.v7.app.AppCompatDelegateImplV7.startSupportActionMode(AppCompatDelegateImplV7.java:696) 
                 at android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.startAsSupportActionMode(AppCompatDelegateImplV14.java:187) 
                 at android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.onWindowStartingActionMode(AppCompatDelegateImplV14.java:171) 
                 at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2432) 
                 at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2419) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:689) 
                 at android.view.View.startActionMode(View.java:4561) 
                 at android.widget.Editor.startSelectionActionMode(Editor.java:1584) 
                 at android.widget.Editor.performLongClick(Editor.java:877) 
                 at android.widget.TextView.performLongClick(TextView.java:8585) 
                 at android.view.View$CheckForLongPress.run(View.java:18768) 
                 at android.os.Handler.handleCallback(Handler.java:808) 
                 at android.os.Handler.dispatchMessage(Handler.java:103) 
                 at android.os.Looper.loop(Looper.java:193) 
                 at android.app.ActivityThread.main(ActivityThread.java:5299) 
                 at java.lang.reflect.Method.invokeNative(Native Method) 
                 at java.lang.reflect.Method.invoke(Method.java:515) 
                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) 
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) 
                 at dalvik.system.NativeStart.main(Native Method) 
                Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=1570 
                 at android.content.res.StringBlock.get(StringBlock.java:65) 
                 at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458) 
                 at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:721) 
                 at android.content.res.TypedArray.getString(TypedArray.java:125) 
                 at android.widget.TextView.<init>(TextView.java:1002) 
                 at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60) 
                at android.support.v7. 

Ist jemand in der Lage zu erklären, was ist das passiert? Ist es irgendwie mit der Hardware/Distribution verwandt?

EDIT 1:

Bitte beachten Sie, dass dies eine große App ist, so kann ich nicht alle Orte schreiben, wo es abstürzt. Dies ist ein Auszug aus dem allerersten EditText, bei dem die App abstürzt.

// LoginActivity.java 
public class LoginActivity extends ApiActivity implements 
    onLoginSuccessListener { 

    @Bind(R.id.login_field_email) 
    protected EditText user; 

    /* OnCreate and other methods... */ 

    @OnTextChanged({R.id.login_field_email, R.id.login_field_password}) 
    public void onAnyFieldChanged() { 
     loginButton.setEnabled(areFieldFilled()); 
    } 

Dies ist der Inhalt Layout XML-Datei:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="16dp" 
    tools:context=".activity.LoginActivity" 
    tools:showIn="@layout/activity_login"> 

    <LinearLayout 
     android:id="@+id/login_forms" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/login_brand" 
     android:orientation="vertical"> 

     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textColorHint="@android:color/white"> 

      <EditText 
       android:id="@+id/login_field_email" 
       style="@style/EditTextLogin" 
       android:hint="@string/registration_email" 
       android:imeOptions="actionNext" 
       android:inputType="textEmailAddress"/> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout> 
       ... 
     </android.support.design.widget.TextInputLayout> 

    </LinearLayout> 

    <Button 
     ... 
    /> 

</RelativeLayout> 

Die styles.xml:

<style name="EditTextLogin" parent="android:Widget.EditText"> 
     <item name="android:fontFamily">sans</item> 
     <item name="android:textColor">@android:color/white</item> 
     <item name="android:singleLine">true</item> 
     <item name="android:maxLines">1</item> 
     <item name="android:layout_width">match_parent</item> 
     <item name="android:layout_height">44dp</item> 
    </style> 

Die build.gradle Dateien:

Plugin anwenden: 'com.android.application' anwenden plugin: 'io.fabric' appl y-Plugin: 'Reich-android'

android { 

    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "..." 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 

    signingConfigs { 
     config { 
      keyAlias '...' 
      keyPassword '...' 
      storeFile file('...') 
      storePassword '...' 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      signingConfig signingConfigs.config 
     } 
     debug { 
      debuggable true 
      useProguard false 
      applicationIdSuffix ".debug" 
     } 
    } 
} 

repositories { 
    mavenCentral() 
    maven { url "https://jitpack.io" } 
    maven { url 'https://maven.fabric.io/public' } 
    maven { url "https://clojars.org/repo/" } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.google.android.gms:play-services-gcm:9.0.2' 
    compile 'com.google.android.gms:play-services-location:9.0.2' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.jakewharton:butterknife:7.0.1' 
} 

Und das Manifest:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      package="es.solbyte.ociohoteles"> 

    <!-- All needed permissions here --> 

    <application 
     android:name=".MyApplication" 
     android:allowBackup="true" 
     android:fullBackupContent="false" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="false" 
     android:theme="@style/Base.AppTheme"> 

     <!-- Login --> 
     <activity 
      android:name=".activity.LoginActivity" 
      android:configChanges="orientation|keyboardHidden|screenSize" 
      android:label="@string/app_name" 
      android:launchMode="singleTop" 
      android:screenOrientation="portrait" 
      android:theme="@style/Base.AppTheme.Login"/> 

    </application> 
<manifest> 

Und für den Fall des BaseApp Thema:

<!-- Base --> 
<style name="Base.AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Colours --> 
    <item name="colorPrimary">@color/primaryColor</item> 
    <item name="colorPrimaryDark">@color/primaryColor_dark</item> 
    <item name="colorAccent">@color/accentColor</item> 
    <item name="android:windowBackground">@color/background_activity</item> 
    <!-- Fonts --> 
    <item name="android:fontFamily">sans-serif</item> 
</style> 
+1

Haben Sie eine Idee wo exac ty in Ihrer App passiert das? Können Sie die relevante XML-Datei anhängen? – Egor

+0

'java.lang.ArrayIndexOutOfBoundsException: length = 15; index = 1570' Diese Zeile deutet darauf hin, dass es irgendwo eine Art Array gibt, die die Dinge durcheinander bringt. Teilen Sie den relevanten Code/XML. – Vucko

+0

@Vucko es ist in der Tat zu einigen Array aber nichts von meinem Code verwandt. Es muss etwas internes sein. – josemigallas

Antwort

0

Dieses von Array-Index verursacht wird, ist aus gebunden. Das heißt, betrachten Sie ein Array von 10 ganzen Zahlen arr [10] und wenn Sie versuchen, auf das 11. Element in diesem Array zuzugreifen, das nicht vorhanden ist. Dieser Fehler wird in Java ausgelöst. Wenn möglich, geben Sie den Code, den Sie ausführen, damit wir ihn reibungsloser debuggen können.

Verursacht von: java.lang.ArrayIndexOutOfBoundsException: length = 15; index = 1570

mehr über Array Vorlesen gebundener Ausnahme here oder here

+0

Ich weiß, was diese Ausnahme bedeutet, das Problem ist, dass ich nicht ein einziges Array in meinem Code habe und dass es nur auf bestimmten Geräten passiert – josemigallas

+0

oh..ist es .. dann post den Code. Dann können wir nur debuggen. – Swathin

+0

Ich habe gerade ein paar Schnipsel hinzugefügt. Dieses Problem ist ein bisschen seltsam und ich vermute, dass es nicht direkt mit meinem Code zusammenhängt, daher bin ich mir nicht sicher, welchen Code ich genau posten soll. Bitte zögern Sie nicht, nach mehr zu fragen. – josemigallas

2

Ich habe gleiches Problem mit editText das Problem in meinem Fall in meinem Stil

war
 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
      <!-- Customize your theme here. --> 
      <item name="colorPrimary">@color/colorPrimary</item> 
      <item name="android:fontFamily" tools:targetApi="jelly_bean">sans-serif</item> 
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
      <item name="colorAccent">@color/colorAccent</item> 
    </style> 

mein Problem gelöst durch Entfernen dieser Codezeile

<item name="android:fontFamily" tools:targetApi="jelly_bean">sans-serif</item> 
+0

Ich werde es so schnell wie möglich überprüfen – josemigallas

+0

Bestätigen, dass es für mich funktioniert. Kudos !!! –

Verwandte Themen