class file for androidx.appcompat.app.AppCompatActivity not found
See original GitHub issueDescribe the bug Android app build fails upgrading to capacitor v3
To Reproduce Following the upgrade steps here: https://capacitorjs.com/docs/v3/updating/3-0#update-android-variables
I installed the alpha release of this plugin:
package.json: "@capacitor-community/firebase-analytics": "^1.0.0-alpha.0",
I’ve tried
ext {
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
androidxAppCompatVersion = '1.1.0' // TRIED keeping 1.1.0 which was working before and tried the recommended 1.2.0. neither work
androidxCoreVersion = '1.3.2'
androidxMaterialVersion = '1.1.0-rc02'
androidxBrowserVersion = '1.3.0'
androidxLocalbroadcastmanagerVersion = '1.0.0'
firebaseMessagingVersion = '21.0.1'
playServicesLocationVersion = '17.1.0'
junitVersion = '4.13.1'
androidxJunitVersion = '1.1.2'
androidxEspressoCoreVersion = '3.3.0'
cordovaAndroidVersion = '7.0.0'
}
Android studio output:
.../node_modules/@capacitor-community/firebase-analytics/android/src/main/java/com/getcapacitor/community/firebaseanalytics/FirebaseAnalytics.java:41: error: cannot access AppCompatActivity
bridge.getActivity()
^
class file for androidx.appcompat.app.AppCompatActivity not found
(hence why I tried downgrading androidxAppCompatVersion
Expected behavior Build to succeed
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): macOS running Android studio 4.1.2
Smartphone (please complete the following information): Pixel 4
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
class file for androidx.appcompat.app.AppCompatActivity not ...
The class is being called from inside an aar library file. The class which extends the AppCompatActivity class does an import of the...
Read more >class file for androidx.appcompat.app ... - CodeRanch
Does anyone knows how to solve the error "class file androidx.appcompat.app.AppCompatActivity not found"? The class is being called from inside an aar ...
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 >AppCompatActivity - Android Developers
Base class for activities that wish to use some of the newer platform features on older Android devices. Some of these backported features...
Read more >Class androidx.appcompat.app.AppCompatActivity
The Activity's ActionBar, or null if it does not have one. ... Set a to act as the ActionBar for this Activity window....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hitting the same issue. My current work around is to add
implementation "androidx.appcompat:appcompat:1.2.0"
into the build.gradle dependencies block for the plugin (e.g. \node_modules@capacitor-community\firebase-analytics\android\build.gradle). This gets the build working for me and analytics is now working as it should but obviously isn’t an ideal fix as I have to do it manually after everynpm i
.Assuming this is something that needs adding to the plugin?
To get my project up and running in the meantime I’ve forked and added the dependency. If it’s of any use to anyone until a fix goes in feel free to use it 😃
I am looking at the Android Variables, i think you are missing
androidxActivityVersion = '1.2.0'
The recommended Variables are