Я не могу запустить свой проект студии Android на старом телефоне Android

Я работаю над игровым проектом для одного из моих классов по программированию в колледже (написан на Java) и использую Android-студию. Я понимаю основы Java, хотя я новичок в студии Android. Моя основная проблема связана с запуском / тестированием моего проекта на старых версиях API/SDK, особенно на старых телефонах.

Я разрабатывал для Android 8.0 (Oreo) на API 26, хотя у меня также установлен Pie (API 28). В настоящее время мой targetSDKVersion равен 26, compileSDKVersion равен 26, а мой minSDKVersion равен 19.

Я пытаюсь запустить свое приложение (называемое AMaze) на Samsung Galaxy S4 (API 19), и поэтому у меня minSDKVersion - 19. Он, насколько мне известно, работает на телефонах, которые поддерживают Android 8.0 и выше, совершенно нормально., Но когда я запускаю приложение на моем Galaxy S4, оно мгновенно открывается и вылетает, говоря: "К сожалению, ваше приложение остановилось". Я не могу понять, как решить это.

Я искал Stackru и веб-сайт разработчиков Android для ответов, но с минимальной удачей. Я попытался очистить и пересобрать проект с помощью Gradle, я попытался отключить Instant Run и попытался сделать compileSDKVersion 19 вместо 26 (но это заставляет компилятор злиться, говоря, что это требуется Google Play быть 26 или выше). Я предполагаю, что мой телефон совместим с Android (см. https://developer.android.com/guide/practices/compatibility), и я следовал инструкциям по подключению телефона к компьютеру ( https://developer.android.com/training/basics/firstapp/running-app). Основываясь на веб-сайте разработчиков, мне кажется, что все, что мне нужно сделать, это установить minSDKVersion на правильный уровень и отрегулировать любое устаревание API и обновления в коде (что, я думаю, я сделал). Но это все еще не работает.

Что я обнаружил, так это то, что мой код создает исключение inflate в методе onCreate() моей основной деятельности (называемой AMazeActivity). Похоже, что причиной этой ошибки могут быть разные вещи, но я не могу понять причину. У этого парня похожая ситуация: android.view.InflateException: двоичный XML-файл: ошибка надувания фрагмента класса.

Вот полное сообщение об ошибке, которое я получаю после запуска приложения на телефоне. Сообщение об ошибке говорит, что мое исключение надувания связано с попыткой надувать Spinner:

12/27 22:08:17: Launching app
No apk changes detected since last installation, skipping installation of C:\Users\jandj\AndroidStudioProjects\AMaze\app\build\outputs\apk\debug\app-debug.apk
$ adb shell am force-stop cs.cs301.amaze
$ adb shell am start -n "cs.cs301.amaze/cs.cs301.amaze.gui.AMazeActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 28224 on device samsung-sgh_m919-47dccee4
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/dalvikvm: Could not find method android.view.Window$Callback.onPointerCaptureChanged, referenced from method android.support.v7.view.WindowCallbackWrapper.onPointerCaptureChanged
W/dalvikvm: VFY: unable to resolve interface method 16265: Landroid/view/Window$Callback;.onPointerCaptureChanged (Z)V
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
W/dalvikvm: VFY: unable to resolve interface method 16267: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
W/dalvikvm: VFY: unable to resolve interface method 16269: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
W/dalvikvm: VFY: unable to resolve interface method 16273: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
W/dalvikvm: VFY: unable to resolve virtual method 708: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
W/dalvikvm: VFY: unable to resolve virtual method 730: Landroid/content/res/TypedArray;.getType (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
I/dalvikvm: Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
W/dalvikvm: VFY: unable to resolve virtual method 485: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getCodeCacheDir, referenced from method android.support.v4.content.ContextCompat.getCodeCacheDir
W/dalvikvm: VFY: unable to resolve virtual method 491: Landroid/content/Context;.getCodeCacheDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getColor, referenced from method android.support.v4.content.ContextCompat.getColor
W/dalvikvm: VFY: unable to resolve virtual method 492: Landroid/content/Context;.getColor (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v4.content.ContextCompat.getColorStateList
W/dalvikvm: VFY: unable to resolve virtual method 493: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getDataDir, referenced from method android.support.v4.content.ContextCompat.getDataDir
W/dalvikvm: VFY: unable to resolve virtual method 495: Landroid/content/Context;.getDataDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getDrawable, referenced from method android.support.v4.content.ContextCompat.getDrawable
W/dalvikvm: VFY: unable to resolve virtual method 496: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getNoBackupFilesDir, referenced from method android.support.v4.content.ContextCompat.getNoBackupFilesDir
W/dalvikvm: VFY: unable to resolve virtual method 503: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method android.support.v4.content.ContextCompat.isDeviceProtectedStorage
W/dalvikvm: VFY: unable to resolve virtual method 516: Landroid/content/Context;.isDeviceProtectedStorage ()Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.startForegroundService, referenced from method android.support.v4.content.ContextCompat.startForegroundService
W/dalvikvm: VFY: unable to resolve virtual method 531: Landroid/content/Context;.startForegroundService (Landroid/content/Intent;)Landroid/content/ComponentName;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
W/dalvikvm: VFY: unable to resolve virtual method 16736: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0002
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
W/dalvikvm: VFY: unable to resolve virtual method 493: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/graphics/drawable/Icon;)
I/dalvikvm: Could not find method android.widget.ImageButton.setImageIcon, referenced from method android.support.v7.widget.AppCompatImageButton.setImageIcon
W/dalvikvm: VFY: unable to resolve virtual method 16759: Landroid/widget/ImageButton;.setImageIcon (Landroid/graphics/drawable/Icon;)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
W/dalvikvm: VFY: unable to resolve virtual method 671: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
W/dalvikvm: VFY: unable to resolve virtual method 673: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
W/dalvikvm: VFY: unable to resolve instanceof 194 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeMaxTextSize, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeMaxTextSize
W/dalvikvm: VFY: unable to resolve virtual method 17062: Landroid/widget/TextView;.getAutoSizeMaxTextSize ()I
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeMinTextSize, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeMinTextSize
W/dalvikvm: VFY: unable to resolve virtual method 17063: Landroid/widget/TextView;.getAutoSizeMinTextSize ()I
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeStepGranularity, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeStepGranularity
W/dalvikvm: VFY: unable to resolve virtual method 17064: Landroid/widget/TextView;.getAutoSizeStepGranularity ()I
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeTextAvailableSizes, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeTextAvailableSizes
W/dalvikvm: VFY: unable to resolve virtual method 17065: Landroid/widget/TextView;.getAutoSizeTextAvailableSizes ()[I
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeTextType, referenced from method android.support.v7.widget.AppCompatTextView.getAutoSizeTextType
W/dalvikvm: VFY: unable to resolve virtual method 17066: Landroid/widget/TextView;.getAutoSizeTextType ()I
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeUniformWithConfiguration, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeUniformWithConfiguration
W/dalvikvm: VFY: unable to resolve virtual method 17109: Landroid/widget/TextView;.setAutoSizeTextTypeUniformWithConfiguration (IIII)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeUniformWithPresetSizes, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeUniformWithPresetSizes
W/dalvikvm: VFY: unable to resolve virtual method 17110: Landroid/widget/TextView;.setAutoSizeTextTypeUniformWithPresetSizes ([II)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.setAutoSizeTextTypeWithDefaults, referenced from method android.support.v7.widget.AppCompatTextView.setAutoSizeTextTypeWithDefaults
W/dalvikvm: VFY: unable to resolve virtual method 17111: Landroid/widget/TextView;.setAutoSizeTextTypeWithDefaults (I)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0006
I/dalvikvm: Could not find method android.widget.TextView.getAutoSizeStepGranularity, referenced from method android.support.v7.widget.AppCompatTextHelper.loadFromAttributes
W/dalvikvm: VFY: unable to resolve virtual method 17064: Landroid/widget/TextView;.getAutoSizeStepGranularity ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0163
I/dalvikvm: Could not find method android.text.StaticLayout$Builder.obtain, referenced from method android.support.v7.widget.AppCompatTextViewAutoSizeHelper.createStaticLayoutForMeasuring
W/dalvikvm: VFY: unable to resolve static method 15540: Landroid/text/StaticLayout$Builder;.obtain (Ljava/lang/CharSequence;IILandroid/text/TextPaint;I)Landroid/text/StaticLayout$Builder;
D/dalvikvm: VFY: replacing opcode 0x71 at 0x0014
D/ProgressBar: setProgressDrawable drawableHeight = 36
D/AbsSeekBar: AbsSeekBar Constructor: mAllowedSeeBarAnimation = true
D/ProgressBar: setProgressDrawable drawableHeight = 36
    setProgressDrawable getHeight() = 0
    updateDrawableBounds: left = 0
    updateDrawableBounds: top = 0
    updateDrawableBounds: right = -96
    updateDrawableBounds: bottom = 0
    updateDrawableBounds: mProgressDrawable.setBounds()
I/dalvikvm: Could not find method android.widget.Spinner.getPopupContext, referenced from method android.support.v7.widget.AppCompatSpinner.getPopupContext
W/dalvikvm: VFY: unable to resolve virtual method 17017: Landroid/widget/Spinner;.getPopupContext ()Landroid/content/Context;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x000d
W/ResourceType: Skipping entry 0x7f050026 in package table 0 because it is not complex!
E/AMazeActivity: onCreate
    android.view.InflateException: Binary XML file line #46: Error inflating class Spinner
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at cs.cs301.amaze.gui.AMazeActivity.onCreate(AMazeActivity.java:39)
        at android.app.Activity.performCreate(Activity.java:5585)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
        at android.app.ActivityThread.access$900(ActivityThread.java:170)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5635)
        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:1291)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
        at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:215)
        at android.content.res.Resources.getTextArray(Resources.java:1626)
        at android.content.res.TypedArray.getTextArray(TypedArray.java:629)
        at android.widget.AbsSpinner.<init>(AbsSpinner.java:74)
        at android.widget.Spinner.<init>(Spinner.java:174)
        at android.widget.Spinner.<init>(Spinner.java:153)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:195)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:166)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:147)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:132)
        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:115)
        at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
        at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at cs.cs301.amaze.gui.AMazeActivity.onCreate(AMazeActivity.java:39) 
        at android.app.Activity.performCreate(Activity.java:5585) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
        at android.app.ActivityThread.access$900(ActivityThread.java:170) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:146) 
        at android.app.ActivityThread.main(ActivityThread.java:5635) 
        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:1291) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
        at dalvik.system.NativeStart.main(Native Method) 
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x417eeda0)
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: cs.cs301.amaze, PID: 28224
    java.lang.RuntimeException: Unable to start activity ComponentInfo{cs.cs301.amaze/cs.cs301.amaze.gui.AMazeActivity}: android.view.InflateException: Binary XML file line #46: Error inflating class Spinner
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
        at android.app.ActivityThread.access$900(ActivityThread.java:170)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5635)
        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:1291)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #46: Error inflating class Spinner
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at cs.cs301.amaze.gui.AMazeActivity.onCreate(AMazeActivity.java:39)
        at android.app.Activity.performCreate(Activity.java:5585)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
        at android.app.ActivityThread.access$900(ActivityThread.java:170) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:146) 
        at android.app.ActivityThread.main(ActivityThread.java:5635) 
        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:1291) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: java.lang.NullPointerException
        at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:215)
        at android.content.res.Resources.getTextArray(Resources.java:1626)
        at android.content.res.TypedArray.getTextArray(TypedArray.java:629)
        at android.widget.AbsSpinner.<init>(AbsSpinner.java:74)
        at android.widget.Spinner.<init>(Spinner.java:174)
        at android.widget.Spinner.<init>(Spinner.java:153)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:195)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:166)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:147)
        at android.support.v7.widget.AppCompatSpinner.<init>(AppCompatSpinner.java:132)
        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:115)
        at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
        at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at cs.cs301.amaze.gui.AMazeActivity.onCreate(AMazeActivity.java:39) 
        at android.app.Activity.performCreate(Activity.java:5585) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
        at android.app.ActivityThread.access$900(ActivityThread.java:170) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:146) 
        at android.app.ActivityThread.main(ActivityThread.java:5635) 
        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:1291) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
        at dalvik.system.NativeStart.main(Native Method) 
I/Process: Sending signal. PID: 28224 SIG: 9
Application terminated.

Вот где происходит сбой в моей основной деятельности. Я пытаюсь заключить код в блок try/catch, чтобы перехватить исключение и распечатать его более четко, как показано выше:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        try {

            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_amaze);
        }
        catch (Exception e) {
            e.getCause();
            Log.e("AMazeActivity", "onCreate", e);
            throw e;
        }
.  .  .
.  .  .

Вещи, на которые стоит обратить внимание: я использую макет "Ограничения" для своих действий, я использую только одно настраиваемое представление в программе и не использую никаких пользовательских тем. Вот файл XML, где исключение жалуется на Spinner:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context="cs.cs301.amaze.gui.AMazeActivity">

   .  .  .

    <TextView
        android:id="@+id/diff_JFrame"
        android:layout_width="248dp"
        android:layout_height="60dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="256dp"
        android:text="Difficulty/Size"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

   .  .  .

    <Spinner
        android:id="@+id/mazeGen"
        android:layout_width="248dp"
        android:layout_height="35dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="120dp"
        android:layout_marginBottom="130dp"
        android:entries="@color/colorAccent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        />
   .  .  .

Я думаю, что это всего лишь вопрос изменения нескольких строк в настройках (может быть, в gradle, файле манифеста, классе R, файле XML и т. Д.), Но я не знаю, что и где изменить. Любая помощь будет принята с благодарностью!

1 ответ

Изменить эту строку

android:entries="@color/colorAccent"

в

android:entries="@array/yourarrayname"
Другие вопросы по тегам