React-native-mapbox-gl: Execution failed for task ':mapbox-react-native-mapbox-gl:compileDebugJavaWithJavac'.

Created on 22 Jun 2018  路  8Comments  路  Source: nitaliano/react-native-mapbox-gl

He, I tried running my app from android studio and it works but when i do react-native run-android i get this error below

> Task :mapbox-react-native-mapbox-gl:compileDebugJavaWithJavac
warning: unknown enum constant Event.ON_STOP
  reason: class file for android.arch.lifecycle.Lifecycle not found
warning: unknown enum constant Event.ON_START
/Users/kenshinman/Desktop/projects/liwc/node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.java:162: error: cannot access LifecycleObserver
            mLocationLayer.onLocationChanged(nextLocation);
                          ^
  class file for android.arch.lifecycle.LifecycleObserver not found
Note: Some input files use or override 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.
1 error
2 warnings


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mapbox-react-native-mapbox-gl:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
96 actionable tasks: 4 executed, 92 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Please help. thanks

Most helpful comment

No throws error on Android Studio

unknown enum constant Event.ON_STOP | 聽
-- | --
unknown enum constant Event.ON_START | 聽

All 8 comments

No throws error on Android Studio

unknown enum constant Event.ON_STOP | 聽
-- | --
unknown enum constant Event.ON_START | 聽

Untested, but it seems to be caused by NDK. Here are several workarounds.
https://stackoverflow.com/questions/42739916/aarch64-linux-android-strip-file-missing

  • 1

@kenshinman have you found a solution for that?

This happens after upgrading gradle
https://github.com/react-native-community/react-native-camera/blob/master/docs/GradleUpgradeGuide.md

Solution update SDK to 27
ext {
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibrariesVersion = '27.1.0'
}

1

This happens after upgrading gradle
https://github.com/react-native-community/react-native-camera/blob/master/docs/GradleUpgradeGuide.md

Solution update SDK to 27
ext {
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibrariesVersion = '27.1.0'
}

The direction is right, but there's no version 27.0.3 so if you are still facing the issue, you should try to use 27.0.2 instead of 27.0.3

And everything should be fine now :)

Reference issue:
https://stackoverflow.com/questions/48354687/could-not-resolve-com-android-supportdesign27-0-3

I am also facing this issue, I have Updated Versions of react and sdk as well let me show you.

ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "12.0.1"
googlePlayServicesAuthVersion = "15.0.1"
}

But still getting this.
What should I do Now?
Please help me out.
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Craytor picture Craytor  路  3Comments

Amalp picture Amalp  路  3Comments

igor9silva picture igor9silva  路  3Comments

kristfal picture kristfal  路  3Comments

madroneropaulo picture madroneropaulo  路  4Comments