HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
57 stars 66 forks source link

Can't create APK for Android API 32 #92

Closed p84torres closed 2 years ago

p84torres commented 2 years ago

[ERROR] [Build] Reason: Couldn't generate your app. For "service" type elements with defined intent filters, you must set a value for "android:exported" in all AndroidManifest.xml files, both in the app and Gradle dependencies.

cgeorg commented 2 years ago

I am running into this issue as well:

android:exported needs to be explicitly specified for element <service#com.marianhello.bgloc.sync.AuthenticatorService>. Apps targeting Android 12 and higher are required to specify an explicit value forandroid:exportedwhen the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Using cordova and cordova-android v11, and the following SDK values:

<preference name="android-minSdkVersion" value="22"/>
<preference name="android-targetSdkVersion" value="32"/>
HarelM commented 2 years ago

I haven't upgraded to cordova-android 11 so this might explain why I don't see these errors. Feel free to submit a PR.

ivinantony commented 2 years ago

On Fri, 22 Jul 2022 at 1:01 PM, Harel M @.***> wrote:

I haven't upgraded to cordova-android 11 so this might explain why I don't see these errors. Feel free to submit a PR.

— Reply to this email directly, view it on GitHub https://github.com/HaylLtd/cordova-background-geolocation-plugin/issues/92#issuecomment-1192273174, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP3POZHAO5JJENJLVODFBYTVVJE3ZANCNFSM537IYOQA . You are receiving this because you are subscribed to this thread.Message ID: <HaylLtd/cordova-background-geolocation-plugin/issues/92/1192273174@ github.com>

I was also having this issue in ionic 6 and I forgot how i fixed it. If i found it i will add it here asap

HarelM commented 2 years ago

This is related to <preference name="android-targetSdkVersion" value="32"/> setting it to 30 will solve this issue. Never the less, this needs to be fixed by adding the export as suggested by the error message. I'm planning on migrating my app in the near future to capacitor 4 which 32 is the default, so I'll probably fix it then, unless someone beats me to it...

cgeorg commented 2 years ago

I created a basic PR here, not sure if there are any guidelines that need to be met for a change like this.

https://github.com/HaylLtd/cordova-background-geolocation-plugin/pull/94

HarelM commented 2 years ago

This was fixed as part of version 2.0.5.