У меня есть это исключение, когда приложение пытается запустить LoginActivity.
ExceptionHandler: Unable to start activity ComponentInfo{Main.activity.LoginActivity_}: android.view.InflateException: Binary XML file line #95: Binary XML file line #95: Error inflating class Button
java.lang.RuntimeException: Unable to start activity ComponentInfo{Main.activity.LoginActivity_}: android.view.InflateException: Binary XML file line #95: Binary XML file line #95: Error inflating class Button
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3003)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3064)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: android.view.InflateException: Binary XML file line #95: Binary XML file line #95: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #95: Error inflating class Button
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 2 to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:737)
at android.widget.TextView.<init>(TextView.java:1451)
at android.widget.Button.<init>(Button.java:113)
at android.widget.Button.<init>(Button.java:106)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:61)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:57)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at Main.activity.LoginActivity_.setContentView(LoginActivity_.java:62)
at Main.activity.LoginActivity_.0onCreate(LoginActivity_.java:44)
at Main.activity.LoginActivity_.onCreate(LoginActivity_.java)
at android.app.Activity.performCreate(Activity.java:6977)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3064)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.ja
А вот код моего файла макета:
<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/bleu_canard"
tools:context=".activity.LoginActivity">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:layout_marginLeft="@dimen/margin_medium">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_accueil"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/alo_login_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/margin_xxbig">
<RelativeLayout
android:id="@+id/alo_admin_grp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/alo_logo_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_menu_white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/margin_small"
android:layout_toRightOf="@+id/alo_logo_image"
android:text="Configurer site et groupe"
android:textColor="@color/white"
android:textSize="@dimen/text_medium" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/alo_form_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alo_admin_grp"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/margin_small"
android:background="@color/white"
android:paddingBottom="@dimen/margin_big"
android:paddingEnd="@dimen/margin_xbig"
android:paddingStart="@dimen/margin_xbig"
tools:context=".LoginActivity">
<Button
android:id="@+id/alo_validate_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alo_show_password_checkbox"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/margin_big"
android:text="@string/login"
android:theme="@style/BleuCanardButton" />
<EditText
android:id="@+id/alo_login_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignParentEnd="false"
android:layout_alignStart="@id/alo_validate_button"
android:layout_marginTop="@dimen/margin_big"
android:hint="@string/login_txt_login"
android:inputType="textCapCharacters"
android:textSize="@dimen/text_medium" />
<EditText
android:id="@+id/alo_password_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_login_edittext"
android:layout_marginTop="@dimen/margin_big"
android:hint="@string/login_txt_password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:textSize="@dimen/text_medium" />
<TextView
android:id="@+id/alo_locked_account_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_password_edittext"
android:text="@string/error_authentification"
android:textColor="@color/red"
android:visibility="invisible" />
<CheckBox
android:id="@+id/alo_show_password_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_locked_account_text"
android:layout_marginTop="@dimen/margin_small"
android:checked="false"
android:text="@string/show_password"
android:textSize="@dimen/text_small" />
<Button
android:id="@+id/alo_pin_modification_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_validate_button"
android:layout_marginTop="@dimen/margin_medium"
android:text="@string/login_change_pin"
android:theme="@style/BleuCanardButton" />
<Button
android:id="@+id/alo_password_modification_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_pin_modification_button"
android:layout_marginTop="@dimen/margin_medium"
android:text="@string/login_change_password"
android:theme="@style/BleuCanardButton" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/alo_tech_info_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/alo_login_layout"
android:layout_alignRight="@+id/alo_login_layout">
<TextView
android:id="@+id/alo_wrapping_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wrappe_no"
android:textColor="@color/white"
android:textSize="@dimen/text_smaller" />
<TextView
android:id="@+id/alo_environmet_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alo_wrapping_text"
android:text="@string/mdm"
android:textColor="@color/white"
android:textSize="@dimen/text_smaller" />
<TextView
android:id="@+id/alo_site_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alo_environmet_text"
android:text="@string/no_site"
android:textColor="@color/white"
android:textSize="@dimen/text_smaller" />
<TextView
android:id="@+id/alo_group_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/alo_site_text"
android:gravity="center_horizontal"
android:text="@string/no_group"
android:textColor="@color/white"
android:textSize="@dimen/text_smaller" />
<TextView
android:id="@+id/alo_app_version_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/alo_group_text"
android:text="@string/app_version"
android:textColor="@color/white"
android:textSize="@dimen/text_smaller" />
</RelativeLayout>
<Spinner
android:id="@+id/alo_environment_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/alo_tech_info_layout"
android:layout_toRightOf="@+id/alo_login_layout"
android:dropDownWidth="wrap_content"
android:visibility="visible" />
<include
layout="@layout/view_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Исключение говорит о том, что проблема возникаетс линии № 95?которая является «подсказкой» внизу.Я не думаю, что проблема возникает из этой строки:
<EditText
android:id="@+id/alo_password_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/alo_validate_button"
android:layout_alignStart="@id/alo_validate_button"
android:layout_below="@+id/alo_login_edittext"
android:layout_marginTop="@dimen/margin_big"
**android:hint="@string/login_txt_password"**
android:imeOptions="actionDone"
android:inputType="textPassword"
android:textSize="@dimen/text_medium" />
Я не понимаю эту часть исключения и связь с раздуванием класса кнопки:
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 2 to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:737)
Вот мой файл strings.xml.Все строки, вызываемые в макете xml, присутствуют в файле.
<!-- Login Activity-->
<string name="development">DEV</string>
<string name="qualification">QUALIF</string>
<string name="recette">REC</string>
<string name="ti">TI</string>
<string name="integration">INTEG</string>
<string name="preprod">PPROD</string>
<string name="production">PROD</string>
<string name="formation">FOR</string>
<string name="wrappe_yes">WRAPPE : OUI</string>
<string name="wrappe_no">WRAPPE : NON</string>
<string name="mdm">MDM : </string>
<string name="set_mdm">MDM : %1$s</string>
<string name="no_site">SITE : Aucun</string>
<string name="set_site">SITE : %1$s</string>
<string name="no_group">GROUPE : Aucun</string>
<string name="set_group">GROUPE : %1$s</string>
<string name="app_version">APP : 0.0.0</string>
<string name="set_app_version">APP : %1$s</string>
<string name="login_txt_login">Identifiant</string>
<string name="login_txt_password">Mot de passe</string>
<string name="login_txt_fill_all_fields">Veuillez fournir votre identifiant et mot de passe.</string>
<string name="login_txt_version">Version %s</string>
<string name="error_authentification">Les informations de connexion sont incorrectes</string>
<string name="error_incorrect_password">Le mot de passe est erroné</string>
<string name="error_incorrect_login">Le nom d\'utilisateur n\'existe pas</string>
<string name="show_password">Afficher les caractères </string>
<string name="hide_password">Cacher les caractères </string>
<string name="login">CONNEXION</string>
<string name="lost_password">Mot de passe oublié ?</string>
<string name="user_does_not_exist">L\'utilisateur demandé n\'existe pas ou le mot de passe est incorrect</string>
<string name="user_locked">Compte bloqué. Vous pourrez réessayer dans %d secondes.</string>
<string name="login_change_password">MODIFIER SON MOT DE PASSE</string>
<string name="login_change_pin">CONNEXION AVEC REINITIALISATION DU PIN</string>
<string name="progress.login">Connexion en cours…</string>
Dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">64dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="header_height">90dp</dimen>
<dimen name="header_title_width">180dp</dimen>
<dimen name="default_button_height">60dp</dimen>
<dimen name="button_big">300dp</dimen>
<dimen name="button_height">80dp</dimen>
<dimen name="margin_xxsmall">3dp</dimen>
<dimen name="margin_xsmall">5dp</dimen>
<dimen name="margin_small">10dp</dimen>
<dimen name="margin_medium">15dp</dimen>
<dimen name="margin_big">30dp</dimen>
<dimen name="margin_xbig">50dp</dimen>
<dimen name="margin_xxbig">80dp</dimen>
<dimen name="text_xxsmaller">16sp</dimen>
<dimen name="text_xsmaller">20sp</dimen>
<dimen name="text_smaller">12sp</dimen>
<dimen name="text_small">14sp</dimen>
<dimen name="text_xsmall">16sp</dimen>
<dimen name="text_medium">18sp</dimen>
<dimen name="text_xmedium">20sp</dimen>
<dimen name="text_big">24sp</dimen>
<dimen name="custom_status_bar_height">24dp</dimen>
<!-- Application dimensions TO CLEAN-->
<dimen name="menu_text_size">25sp</dimen>
<dimen name="menu_text_size_big">50sp</dimen>
<dimen name="filter_pane_minWidth">300dp</dimen>
<dimen name="filter_pane_Width">0dp</dimen>
<dimen name="vcf_left">150dp</dimen>
<dimen name="tv_documentsView_empty_minWith">300dp</dimen>
<dimen name="tv_documentsView_empty_minHeight">100dp</dimen>
<dimen name="dialog_synchronization_minWidth">600dp</dimen>
<dimen name="dialog_download_report_minWidth">600dp</dimen>
<dimen name="tv_documents_synchronization_padding">6dp</dimen>
<dimen name="pbar_documents_synchronization_minWidth">300dp</dimen>
<dimen name="pbar_documets_synchronization_minHeight">25dp</dimen>
<dimen name="lv_documents_synchronization_minHeight">100dp</dimen>
<dimen name="btn_application_padding">6dp</dimen>
<dimen name="btn_application_margin">15dp</dimen>
<dimen name="tv_separator_padding">6dp</dimen>
<dimen name="tv_spacingPadding">15dp</dimen>
<dimen name="pbar_spacingPadding">15dp</dimen>
<dimen name="tv_drawablePadding">15dp</dimen>
<dimen name="row_synchronization_minHeight">50dp</dimen>
<dimen name="btn_synchronization_cancel_minWidth">200dp</dimen>
<dimen name="question_size">28sp</dimen>
<dimen name="layout_margin_medium">100dp</dimen>
<dimen name="layout_margin_medium2">175dp</dimen>
<dimen name="pdf_bookmark_drawer_width">400dp</dimen>
<dimen name="pdf_bookmark_row_height">50dp</dimen>
<dimen name="ops_recycler_width_xsmall">260dp</dimen>
<dimen name="ops_recycler_width">300dp</dimen>
<dimen name="ops_recycler_width_big">450dp</dimen>
<dimen name="ops_recycler_width_small">360dp</dimen>
<dimen name="ops_recycler_height">150dp</dimen>
</resources>
Эта проблема возникла только у одного пользователя приложения