question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting "class file for androidx.appcompat.app.AppCompatActivity not found" while building

See original GitHub issue

I’m getting an error while building the app in Android Studio:

.../node_modules/capacitor-fcm/android/capacitor-fcm/src/main/java/io/stewan/capacitor/fcm/FCMPlugin.java:96: error: cannot access AppCompatActivity
        FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(getActivity(),  new OnSuccessListener<InstanceIdResult>() {
                                                                                         ^
  class file for androidx.appcompat.app.AppCompatActivity not found

I’m using @capacitor/core v 2.0.0 and @capacitor/android v 2.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
stewonescommented, Jun 29, 2020

FWIW I’ve just faced the same issue

to fix it add this to your app gradle.properties

android.useAndroidX=true
android.enableJetifier=true

clean project + rebuild in Android Studio

5reactions
Ajax-uacommented, Apr 8, 2020

Removing and adding Android platform has solved the issue. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

class file for androidx.appcompat.app.AppCompatActivity not ...
My current work around is to add implementation "androidx. appcompat:appcompat:1.2. 0" into the build. gradle dependencies block for the plugin ...
Read more >
android - can't resolve AppCompatActivity - Stack Overflow
Solution : Go to your build.gradle file and in your dependencies find the appcompat one, something like compile 'com.android.support:appcompat-v7:XX.X.X'.
Read more >
Different Ways to fix Cannot resolve symbol ... - GeeksforGeeks
Go to your build.gradle(Module:app) file and in the dependencies section the appcompat one, you should see something like compile 'com.android.
Read more >
class file for androidx.appcompat.app ... - CodeRanch
AppCompatActivity not found "? The class is being called from inside an aar library file. The class which extends the AppCompatActivity class does...
Read more >
AppCompatActivity - Android Developers
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar. @Nullable ActionMode.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found