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

react-native-charts-wrapper:compileDebugJavaWithJavac FAILED #552

Closed
hsa1280 opened this issue Jun 18, 2019 · 7 comments
Closed

react-native-charts-wrapper:compileDebugJavaWithJavac FAILED #552

hsa1280 opened this issue Jun 18, 2019 · 7 comments

Comments

@hsa1280
Copy link

hsa1280 commented Jun 18, 2019

Hi, I am trying to build an Android application, when I do ./gradlew assembleDebug under android folder, I got this error:

> Task :react-native-charts-wrapper:compileDebugJavaWithJavac FAILED
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/listener/RNOnChartGestureListener.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:5: error: package android.support.v4.content.res does not exist
import android.support.v4.content.res.ResourcesCompat;
                                     ^
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/listener/RNOnChartGestureListener.java:93: error: cannot find symbol
    @NonNull
     ^
  symbol:   class NonNull
  location: class RNOnChartGestureListener
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:25: error: cannot find symbol
    private Drawable backgroundLeft = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker_left, null);
                                      ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:26: error: cannot find symbol
    private Drawable background = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker, null);
                                  ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:27: error: cannot find symbol
    private Drawable backgroundRight = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker_right, null);
                                       ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:29: error: cannot find symbol
    private Drawable backgroundTopLeft = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker_top_left, null);
                                         ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:30: error: cannot find symbol
    private Drawable backgroundTop = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker_top, null);
                                     ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
/Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/markers/RNRectangleMarkerView.java:31: error: cannot find symbol
    private Drawable backgroundTopRight = ResourcesCompat.getDrawable(getResources(), R.drawable.rectangle_marker_top_right, null);
                                          ^
  symbol:   variable ResourcesCompat
  location: class RNRectangleMarkerView
Note: /Users/shianhuang/projects/mobile/node_modules/react-native-charts-wrapper/android/src/main/java/com/github/wuxudong/rncharts/charts/CustomFormatter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
9 errors



my build.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
        }
    }
}
@adambutler
Copy link

@hsa1280 Seems to be a broader issue check out facebook/react-native#25293

@vikrantshroti
Copy link

It seems like android support libraries are unavailable, check version.

@hsa1280
Copy link
Author

hsa1280 commented Jun 19, 2019

Thanks @adambutler and @vikrantshroti . I have tried those solutions, so far, no luck to solve the problem. Do you guys face similar issue?

@hsa1280
Copy link
Author

hsa1280 commented Jun 20, 2019

For anyone has the same issue, please refer to this link: facebook/react-native#25292 (comment). I solved my problem by adding this change in android/build.gradle:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.google.android.gms'
                && details.requested.name.contains('play-services-gcm')) {
                details.useVersion '16.0.0'
            }
        }
    }
}

@hsa1280 hsa1280 closed this as completed Jun 20, 2019
@cengit
Copy link

cengit commented Mar 22, 2021

android run command: npx jetify, fixed my issue

@girish54321
Copy link

I don't know why, but yarn jetify is not working 🤔🧐
But npx jetify is working <= this will resolve the build error.

@ToThangGTVT
Copy link

I don't know why, but yarn jetify is not working 🤔🧐 But npx jetify is working <= this will resolve the build error.

I worked for me

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

6 participants