react-native-image-crop-picker: Execution failed for task ':react-native-image-crop-picker:compileDebugJavaWithJavac'
Version
- react-native-image-crop-picker v^0.25.0
- react-native v^0.59.8
Platform
- Android
Expected behavior
Expecting it to build successfully and I start the implementation
Actual behavior
It is not building and it is throwing an error in the terminal. See attached code and the error that is being thrown.
Please Note.
- I have done everything that was defined in the Readme.md
- I have also checked out all related issues but no solution worked for me.
Attachments
my android/build.gradle
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
google()
jcenter()
// maven {
// // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
// // url "$rootDir/../node_modules/react-native/android"
// // url 'https://jitpack.io'
// // url 'https://maven.google.com'
// maven { url 'https://jitpack.io' }
// maven { url 'https://maven.google.com' }
// url "$rootDir/../node_modules/react-native/android"
// }
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
}
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 18
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
subprojects { subproject ->
afterEvaluate {
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
// To check for a certain build type, use variant.buildType.name == "<buildType>"
if (names.contains("reactNative51") || names.contains("reactNative55")) {
// Gradle ignores any variants that satisfy the conditions above.
setIgnore(true)
}
}
}
}
}
}
Error that is thrown in the terminal
> rn_c@0.0.1 android /Users/fahadasiimwe/projects/native/rn_c
> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
> Configure project :react-native-navigation
downloadRobolectricDependencies into /Users/fahadasiimwe/projects/native/rn_c/android/build/robolectric-3.5.1-dependencies
> Task :react-native-image-crop-picker:compileDebugJavaWithJavac FAILED
/Users/fahadasiimwe/projects/native/rn_c/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:20: error: package androidx.core.app does not exist
import androidx.core.app.ActivityCompat;
^
/Users/fahadasiimwe/projects/native/rn_c/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:21: error: package androidx.core.content does not exist
import androidx.core.content.FileProvider;
^
/Users/fahadasiimwe/projects/native/rn_c/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:228: error: cannot find symbol
int status = ActivityCompat.checkSelfPermission(activity, permission);
^
symbol: variable ActivityCompat
location: class PickerModule
/Users/fahadasiimwe/projects/native/rn_c/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:316: error: cannot find symbol
mCameraCaptureURI = FileProvider.getUriForFile(activity,
^
symbol: variable FileProvider
location: class PickerModule
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-crop-picker: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. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
19 actionable tasks: 1 executed, 18 up-to-date
error 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/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rn_c@0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rn_c@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fahadasiimwe/.npm/_logs/2019-08-20T09_45_53_106Z-debug.log
Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 17
- Comments: 21
RN 0.62.2 same error with the latest version (0.39.0) Downgrade to v.0.38.0 helped
Firstly I setup project for use androidX and x64 bits support.
"react-native": "0.59.9", "react-native-image-crop-picker": "^0.21.1",
You can find guides for upgrading react-native and enabling x64 bits support in google.
add to
gradle.properties
:android.useAndroidX=true android.enableJetifier=true
app/build.gradle
:dependencies {
...
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
}
then I do:yarn add jetifier
npx jetifier
react-native run-android
same issue… “react-native”: “0.63.2”, “react-native-image-crop-picker”: “^0.35.0”
This solved the issue for me
The same issue.
Same problem. Jetifier does not solve the issue. react-native-image-crop-picker 0.21.1
I have the same issue as the OP, and the workaround of @gavrilin-remote doesnt work for me
Thanks a lot, @gavrilin-remote, This truly helped. My app builds successfully.
If you use RN “0.68.2”, use react-native-image-crop-picker version “^0.37.3”. It works fine in my project
Same here
Downgrading to version 0.38.0 fixed my issue. I’m currently using React Native 0.70.6.