capacitor-community / background-geolocation

A Capacitor plugin that sends you geolocation updates, even while the app is in the background.
MIT License
180 stars 56 forks source link

No variants found on Android build #29

Closed jongbonga closed 3 years ago

jongbonga commented 3 years ago

Describe the bug I'm getting the exact same issue as #9 on version 1.0.2 for capacitor 3

Here is a snippet of the error log

No variants found for ':capacitor-community-background-geolocation'. Check build files to ensure at least one variant exists. at: com.android.tools.idea.gradle.project.sync.idea.svs.AndroidModule.deliverModels(AndroidModule.kt:191) com.android.tools.idea.gradle.project.sync.idea.svs.AndroidExtraModelProvider$Worker.populateBuildModels(AndroidExtraModelProvider.kt:121)

To Reproduce Followed the installation instructions and run on Android

Expected behavior To not run through a build error

Smartphone (please complete the following information):

diachedelic commented 3 years ago

I would try this:

diachedelic commented 3 years ago

Additionally, you could try running Build -> "Clean Project" in Android Studio.

jongbonga commented 3 years ago

@diachedelic I have tried it dozens of time 🥲 cleared cache & restarted Android studio, removed the Android folder 🥲.

I have a couple of other plugins capacitor (intercom, barcode scanner, google map) that are syncing fine. Gradle fails the syncing when this one is in, but sync fine without it.

diachedelic commented 3 years ago

You say it's the exact same issue as #9: but do you also see the message _Error: package com.equimaps.capacitor_backgroundgeolocation does not exist in the error log?

You might want to compare the value of compileSdkVersion in your app, your working plugins, and this plugin. See https://github.com/react-native-image-picker/react-native-image-picker/issues/1635

jongbonga commented 3 years ago

You say it's the exact same issue as #9: but do you also see the message _Error: package com.equimaps.capacitor_backgroundgeolocation does not exist in the error log?

Screenshot 2021-07-07 at 16 10 38
jongbonga commented 3 years ago

You might want to compare the value of compileSdkVersion in your app, your working plugins, and this plugin. See react-native-image-picker/react-native-image-picker#1635

I tried with 29 but nothing new happened

diachedelic commented 3 years ago

How about this: https://stackoverflow.com/a/67695836

diachedelic commented 3 years ago

Also, what do you see in the "Build Variants" panel?

jongbonga commented 3 years ago

https://stackoverflow.com/a/67695836

I have both API levels 29 & 30 installed.

I didn't encounter any issue with capacitor v2 and corresponding plugin. since the upgrade, I'm unable to build

jongbonga commented 3 years ago

Build Variants

Please help me locate the panel.

jongbonga commented 3 years ago

Went as far as to reinstall Android Studio but the error percists.

diachedelic commented 3 years ago

In the bottom left of your screenshot there is a "Build Variants" tab.

Try cloning this repository and running the application in the "example" directory. Then we can know if there is a problem with your project in particular, or your IDE.

jongbonga commented 3 years ago

In the bottom left of your screenshot, there is a "Build Variants" tab.

Screenshot 2021-07-09 at 10 55 55

Try cloning this repository and running the application in the "example" directory. Then we can know if there is a problem with your project in particular or your IDE.

I tried and it worked fine, but also noticed capacitor is still in RC on the example (I'm haven't tried to update it)

diachedelic commented 3 years ago

This is what my Build Variants panel looks like:

image

Could you please trying upgrading Capacitor (in the cloned repo) to the latest version and seeing if the error manifests itself?

jongbonga commented 3 years ago

I tried and it worked fine, but also noticed capacitor is still in RC on the example (I'm haven't tried to update it)

I just realized that I only test on iOS when adding this comment.

jongbonga commented 3 years ago

Fresh clone, ran fine before and after updating Capacitor 😔

diachedelic commented 3 years ago

Then there must be an incompatibility between this plugin and your project. I can think of these approaches:

jongbonga commented 3 years ago

Also, what do you see in the "Build Variants" panel?

when I remove the plugin, this is what my build variants panel looks like

Screenshot 2021-07-09 at 22 59 15
jongbonga commented 3 years ago
  • Examine the difference between the build.gradle and app/build.gradle files of the example and of your project.

The only difference is the example uses a "local version" of the plugins & mine comes from node_modules (which I don't think matters much). And my Gradle version is 7.

I will try the other suggestions and revert with findings

jongbonga commented 3 years ago

I created a brand new project, only added this plugin and nothing else

Screenshot 2021-07-10 at 11 31 00
ktoala commented 3 years ago

Same error :/

ktoala commented 3 years ago

using this properties in variables.gradle the message disappear, compile successfully and work ext { minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 androidxActivityVersion = '1.2.0' androidxAppCompatVersion = '1.2.0' androidxBrowserVersion = '1.3.0' androidxLocalbroadcastmanagerVersion = '1.0.0' androidxCoordinatorLayoutVersion = '1.1.0' androidxCoreVersion = '1.3.2' androidxFragmentVersion = '1.3.0' playServicesLocationVersion = '17.0.0' junitVersion = '4.13.1' androidxJunitVersion = '1.1.2' androidxEspressoCoreVersion = '3.3.0' cordovaAndroidVersion = '7.0.0' }

diachedelic commented 3 years ago

How does that variables.gradle file differ from the default?

jongbonga commented 3 years ago

How does that variables.gradle file differ from the default?

Mine didn’t have androidxLocalbroadcastmanagerVersion, playServicesLocationVersion & androidxBrowserVersion per default

diachedelic commented 3 years ago

I believe I have fixed this issue in release v1.0.3. Can you please test? You should not need to modify your variables.gradle file from the default.

benedictcontawe commented 1 year ago

I have this problem to in old projects

Ozaoujal commented 7 months ago

I have this problem too, I was in react-native v0.64.2, the problem occur when upgrading to react-native v0.71.8