Краш приложения Android сразу после запуска

Вот трассировка стека:

06/26 15:42:08: Launching app
$ adb shell am start -n "com.virtual.ai/com.virtual.ai.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 19346 on device oneplus-oneplus_a6010-eb048141
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/m.Karbi.chonan: The ClassLoaderContext is a special shared library.
W/ActivityThread: Application com.virtual.ai can be debugged on port 8100...
I/Perf: Connecting to perf service.
V/FA: Registered activity lifecycle callback
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
    com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
I/FirebaseInitProvider: FirebaseApp initialization successful
E/libc: Access denied finding property "vendor.debug.egl.profiler"
    Access denied finding property "vendor.debug.prerotation.disable"
W/com.virtual.ai: type=1400 audit(0.0:141094): avc: denied { read } for comm=45474C20496E6974 name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=22713 scontext=u:r:untrusted_app:s0:c88,c257,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
V/FA: Collection enabled
V/FA: App package, google app id: com.virtual.ai, 1:621374270923:android:1dc713bff6faa7cc
V/FA: onActivityCreated
I/FA: App measurement is starting up, version: 16250
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.virtual.ai
D/FA: Debug-level message logging enabled
W/m.virtual.ai: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/m.virtual.ai: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.virtual.ai, PID: 19346
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.virtual.ai/com.virtual.ai.MainActivity}: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class info.hoang8f.widget.FButton
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3037)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6863)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class info.hoang8f.widget.FButton
     Caused by: android.view.InflateException: Binary XML file line #43: Error inflating class info.hoang8f.widget.FButton
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:647)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.virtual.ai.MainActivity.onCreate(MainActivity.java:20)
        at android.app.Activity.performCreate(Activity.java:7149)
        at android.app.Activity.performCreate(Activity.java:7140)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3017)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6863)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
        at android.content.res.TypedArray.getColor(TypedArray.java:501)
        at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
        at info.hoang8f.widget.FButton.<init>(FButton.java:52)
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at com.virtual.ai.MainActivity.onCreate(MainActivity.java:20) 
        at android.app.Activity.performCreate(Activity.java:7149) 
        at android.app.Activity.performCreate(Activity.java:7140) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3017) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6863) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
W/OPDiagnose: getService:OPDiagnoseService NULL
D/OSTracker: OS Event: crash
I/Process: Sending signal. PID: 19346 SIG: 9
Application terminated.

Должен ли я внести некоторые изменения здесь? Ошибка, которую я получаю, связана со встроенной версией.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.virtual.ai"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-core:10.2.0'
    implementation 'com.google.firebase:firebase-database:10.2.0'
    implementation 'info.hoang8f:fbutton:1.0.5'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.firebaseui:firebase-ui-database:1.2.0'
    implementation 'com.android.support:design:26.+'
    implementation "com.google.android.material:material:1.0.0"
    implementation "androidx.recyclerview:recyclerview:1.0.0"
    implementation "androidx.cardview:cardview:1.0.0"

}
apply plugin: 'com.google.gms.google-services'

Вот код main_activity.xml:

<LinearLayout
    android:layout_width="368dp"
    android:layout_height="583dp"
    android:layout_centerInParent="true"
    android:orientation="vertical">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:contentDescription="@string/des"
        android:src="@drawable/logo" />

    <TextView
        android:id="@+id/txtSlogan"
        android:layout_width="match_parent"
        android:layout_height="211dp"
        android:gravity="center"
        android:text="@string/slogan"
        android:textColor="@android:color/white" />


</LinearLayout>


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="85dp"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal"
    android:weightSum="2">


    <info.hoang8f.widget.FButton
        android:id="@+id/btnSignUp"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:layout_weight="1"
        android:text="@string/SignUp"
        android:textColor="@android:color/white"
        app:buttonColor="@color/darkGreen"
        app:cornerRadius="4dp"
        app:shadowColor="@android:color/black"
        app:shadowEnabled="true"
        app:shadowHeight="2dp" />

    <info.hoang8f.widget.FButton
        android:id="@+id/btnSignIn"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:layout_weight="1"
        android:text="@string/SignIn"
        android:textColor="@android:color/white"
        app:buttonColor="@color/lightGreen"
        app:cornerRadius="4dp"
        app:shadowColor="@android:color/black"
        app:shadowEnabled="true"
        app:shadowHeight="2dp" />

</LinearLayout>


person Wade    schedule 25.06.2019    source источник
comment
Любая помощь и один   -  person Wade    schedule 26.06.2019
comment
Можете ли вы также добавить свой основной код активности? Все, что я могу сделать из трассировки стека, это то, что возможная причина связана с info.hoang8f.widget.FButton (из-за этого - Ошибка при раздувании класса info.hoang8f.widget.FButton) и, возможно, с цветом (из-за это - Невозможно преобразовать значение с индексом 1 в цвет) Лично я не использовал nfo.hoang8f.widget.FButton и, следовательно, не могу комментировать это. Попробуйте проверить указанные выше строки и, надеюсь, вы найдете проблему.   -  person Derryl Thomas    schedule 27.06.2019
comment
@DerrylThomas, вот ссылка на основной код активности. =1irjIW6Q1s71K00Kz_b2t8Tn38J6t8jLD   -  person Wade    schedule 27.06.2019
comment
Взгляните на ответ, который я разместил. Надеюсь, это решит вашу проблему. :)   -  person Derryl Thomas    schedule 27.06.2019
comment
@DerrylThomas, у вас есть идеи, какие зависимости использовать вместо этого, поскольку «info.hoang8f: android-segmented: 1.0.6» не имеет некоторых опций или функций макета. Так, что с com.android я тоже не перепутаю. и версия androidx   -  person Wade    schedule 27.06.2019


Ответы (2)



Насколько я знаю, InstantRun является экспериментальной функцией.

Пожалуйста, попробуйте отключить его.

См. описание того, когда это не работает, в документации: https://developer.android.com/studio/run/index.html#instant-run

Обновление:

Кстати, в исходном описании вопроса был такой текст: «I/InstantRun: запуск сервера мгновенного запуска: приложение основного процесса завершено».

Вот почему пришло мое предложение и предположение.

Я не прошу полностью отключить InstantRun. Просто проверьте это. Если это поможет, то необходимо изменить код, чтобы подтвердить требования InstantRun, упомянутые в документах (или указать там ошибку для InstantRun).

person Alexandr    schedule 26.06.2019
comment
Это не дает ответа на вопрос. Чтобы подвергнуть критике или запросить разъяснения у автора, оставьте комментарий под его публикацией. – Из обзора - person Mihai Chelaru; 26.06.2019
comment
На самом деле я думаю, что это ответ с решением отключить InstantRun. Мгновенный запуск упоминается в деталях вопроса. Также этот InstantRun не используется в APK. Так много вопросов говорит, что это поможет. Это не разъяснение, не предложение, не отношение. Это предложение решения. Надеюсь, вы воспроизвели проблему и доказали, что отключение InstantRun не помогает, прежде чем понизить мой ответ;) - person Alexandr; 26.06.2019
comment
Просто для протокола, я не был тем, кто минусовал. Я видел это в очереди на проверку, и мне это показалось скорее комментарием о том, что сначала попробуйте сделать это, а потом отчитаетесь. Вы могли бы, по крайней мере, включить ссылку на соответствующую документацию по Instant Run, которую вы упомянули в своем ответе, или, что еще лучше, процитировать ее в своем ответе со ссылкой на первоисточник. - person Mihai Chelaru; 26.06.2019
comment
Я понимаю вашу точку зрения, но я отключил опцию мгновенного запуска, я видел, что многие сталкивались с одной и той же проблемой, когда использовали эту функцию. Однако мне это не помогло. Я попробовал это, а также перенес все свои зависимости на Androidx. тем не менее, я не могу протестировать свое приложение, без тестирования становится трудно понять, что нужно добавить в приложение. Самое смешное, что теперь я не получаю никаких ошибок при сборке Gradle и сборке apk. Единственное, что он сразу же прекращается, как только он запускается. - person Wade; 26.06.2019
comment
Последнее, что я могу сделать, это поделиться своим проектом, чтобы вы могли проверить, что пошло не так @MihaiChelaru - person Wade; 26.06.2019