can't resolve AppCompatActivity

后端 未结 30 1701
星月不相逢
星月不相逢 2020-12-04 17:43

After renaming application package name, Android Studio displayed this error can\'t resolve symbol AppCompatActivity

Things I tried: <

相关标签:
30条回答
  • 2020-12-04 18:31

    When all your dependencies and SDK tools are in-line and it still is giving sync error. Add this code in your build.Gradle and sync it:

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    Also like to point, before doing this I tested all tricks mentioned here. But only this worked for my Android (2.3) - Feb'17 release.

    0 讨论(0)
  • 2020-12-04 18:31

    Open build.gradle file and in your dependencies and

    Change file with

    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'

    This worked for me..

    0 讨论(0)
  • 2020-12-04 18:32

    Go to your build.gradle file and in your dependencies find the appcompat one, something like compile 'com.android.support:appcompat-v7:25.X.X' Change it to compile 'com.android.support:appcompat-v7:25.3.+' Then click on Sync Now on the top right of the editor. Then go back to your build.gradle and change it back to whatever it was and click Sync Now This worked for me.

    0 讨论(0)
  • 2020-12-04 18:32

    This working for me, on macOS:

    go to, Android Studio -> Preferences -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Platforms And download Android SDK Platform XX and Sources for Android XX. Where XX es the value of compileSdkVersion on your gradle (Module:app)

    on Windows the route is: File -> Settings... -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Platforms

    0 讨论(0)
  • 2020-12-04 18:32

    Easy

    • Open app level build.gradle
    • Remove appcompact-v7 dependency & Sync.
    • Add dependency again & Sync.

    Error is no more! :)

    Before

    After

    0 讨论(0)
  • 2020-12-04 18:33

    You got error like

    1.First you have to clean project after that same issue got then

    2.check library minimum compile "com.android.support:appcompat-v7:22.1.0"

    1. Check library does not use two or more times

    2. Remove multiple time usage of library dependency

    3. Clean and Rebuild Project to a got solution
    0 讨论(0)
提交回复
热议问题