Error “package android.support.v7.app does not exist”

前端 未结 16 1696
-上瘾入骨i
-上瘾入骨i 2020-11-30 02:03

I am new to android development, and I have been using the command line tools to create an android project. I followed all the instructions given in the tutorial at android

相关标签:
16条回答
  • 2020-11-30 02:24

    First of all check if your project is using androidx or android support library. Check gradle.properties file:

    android.useAndroidX=true

    android.enableJetifier=true

    If it contains the above lines, it is using androidx with an old code from some old tutorial.

    In build.gradle (module:app)

    Use

    implementation 'androidx.appcompat:appcompat:1.0.0'
    

    Instead of

    compile 'com.android.support:appcompat-v7:28.0.0'
    

    Also in MainActivity.java : Use

    import androidx.appcompat.app.AppCompatActivity;
    

    instead of :

    import android.support.v7.app.AppCompatActivity;
    
    0 讨论(0)
  • 2020-11-30 02:25

    Switching to AndroidX helped me: import androidx.appcompat.app.AppCompatActivity;

    0 讨论(0)
  • 2020-11-30 02:31

    try to copy C:\Program Files\Java\jdk1.8.0_121 && C:\Program Files\Java\jre1.8.0_121 from other working PC then all (clean && rebuild)

    0 讨论(0)
  • 2020-11-30 02:31

    After Rebuild the project issue resolved..

    0 讨论(0)
提交回复
热议问题