Solution: New Project (default AndroidX) into Android project starts always flash back

Android Studio3.5.2, new projects are the default AndroidX, would like to change android project, changes are as follows:

A .gradle.properties (Project Properties), read as follows:

android.useAndroidX=false
android.enableJetifier=false

Two .build.gradle (Module: app), read as follows:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Three .MainActivity, references to read as follows:

import android.support.v7.app.AppCompatActivity;

I just like this after modification, run after flash back, flash back to a start APP console "Logcat" no abnormal captured to Ben collapse, and finally investigation found, there is still a thing without modification

Four .activity_main.xml, (too easily overlooked)

<androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

 Change

<android.support.constraint.ConstraintLayout>

</android.support.constraint.ConstraintLayout>

Little bug, are caused by carelessness, this warning!

Published 66 original articles · won praise 11 · views 30000 +

Guess you like

Origin blog.csdn.net/weixin_40420578/article/details/104051333