Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background service not starting on Android #209

Open
apapalillo opened this issue Jan 23, 2024 · 3 comments
Open

Background service not starting on Android #209

apapalillo opened this issue Jan 23, 2024 · 3 comments

Comments

@apapalillo
Copy link

Hi everybody

I encountered an issue in the past days. After upgrading RN to 0.72 the background service wasn't starting anymore

After hours of debugging I figured out I needed to add an exclusion in the proguard file:

# React Native Background Actions
-keep public class com.asterinet.react.bgactions.** {*;}

Best regards!

@pmdev71
Copy link

pmdev71 commented Jan 23, 2024

I think the service is not automatically added, so you'll need to add it in your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
    ...
    <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />
   ...
  </application>
</manifest>

@apapalillo
Copy link
Author

I think the service is not automatically added, so you'll need to add it in your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
    ...
    <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />
   ...
  </application>
</manifest>

Hi pmdev71, thanks for your feedback. I also thought it could be a manifest issue, but I found out it was already correctly declared in there. Only the proguard rule fixed the issue for me.

@Ivandeclei
Copy link

i have same problem, the message is

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-background-actions'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

 android {
     namespace 'com.example.namespace'
 }

 If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants