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

Execution failed for task ':react-native-background-job:compileDebugJavaWithJavac'. #134

Open
kishansbs opened this issue Aug 31, 2019 · 3 comments

Comments

@kishansbs
Copy link

Task :react-native-background-job:compileDebugJavaWithJavac FAILED
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/ReactNativeEventStarter.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/Utils.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/BackgroundJobModule.java:7: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/ExactJob.java:6: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/ReactNativeEventStarter.java:29: error: cannot find symbol
public ReactNativeEventStarter(@nonnull Context context) {
^
symbol: class NonNull
location: class ReactNativeEventStarter
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/ReactNativeEventStarter.java:34: error: cannot find symbol
public void trigger(@nonnull Bundle jobBundle) {
^
symbol: class NonNull
location: class ReactNativeEventStarter
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/Utils.java:14: error: cannot find symbol
public static boolean isReactNativeAppInForeground(@nonnull ReactNativeHost reactNativeHost) {
^
symbol: class NonNull
location: class Utils
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/BackgroundJobModule.java:146: error: cannot find symbol
@nullable @OverRide public Map<String, Object> getConstants() {
^
symbol: class Nullable
location: class BackgroundJobModule
/Users/machd/Desktop/RN_Projects/projectname/node_modules/react-native-background-job/android/src/main/java/com/pilloxa/backgroundjob/ExactJob.java:14: error: cannot find symbol
@OverRide protected void onHandleIntent(@nullable Intent intent) {
^
symbol: class Nullable
location: class ExactJob
9 errors
3 warnings

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-background-job:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@rasheedk
Copy link

Hi, @kishansbs
This issue is due to android x.

don't know how you use the library, but preventing Jetifier from migrating to AndroidX seems to solve this issue.

#Local module Gradle settings.
android.useAndroidX=false
#Jetifier will convert support libraries of all your dependencies to AndroidX automatically,
# if you don't set it true then your project will have both support
android.enableJetifier=false

Please let me know weather it solved your problem ?

@showtan001
Copy link

Change like this:
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

@snowfluke
Copy link

Change like this:
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Thanks bro, this working for me. Changing the line where the error pointed out from 'android.support' to 'androidx'.

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

4 participants