I have an android react-native app that is running in eject mode.
After updating react-native from 0.64.3 to 0.71.2 and manually updating every relevant file, it can't resolve any module when running, the first module imported in the app is 'react-native-gesture-handler', so that is the one that throws the error, but trying to import expo first, for example, resulted in the same error but with expo.
Error:
error: Error: Unable to resolve module react-native-gesture-handler from E:\SteveQueue\index.js: react-native-gesture-handler could not be found within the project or in these directories:
node_modules
> 1 | import 'react-native-gesture-handler';
| ^
2 | import { registerRootComponent } from 'expo';
3 |
4 | import App from './App';
at ModuleResolver.resolveDependency (E:\SteveQueue\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:162:15)
at DependencyGraph.resolveDependency (E:\SteveQueue\node_modules\metro\src\node-haste\DependencyGraph.js:260:43)
at Object.resolve (E:\SteveQueue\node_modules\metro\src\lib\transformHelpers.js:177:21)
at Graph._resolveDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:432:35)
at Graph._processModule (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:218:38)
at async Graph._traverseDependenciesForSingleFile (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:207:5)
at async Promise.all (index 0)
at async Graph.initialTraverseDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\Graph.js:191:5)
at async DeltaCalculator._getChangedDependencies (E:\SteveQueue\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:196:25)
at async DeltaCalculator.getDelta (E:\SteveQueue\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:90:16)
Build output:
> Configure project :expo
Using expo modules
- expo-application (5.0.1)
- expo-constants (14.0.2)
- expo-error-recovery (4.0.1)
- expo-file-system (15.1.1)
- expo-font (11.0.1)
- expo-keep-awake (11.0.1)
- expo-modules-core (1.1.1)
- expo-splash-screen (0.17.5)
> Task :expo-constants:createDebugExpoConfig
Execution optimizations have been disabled for task ':expo-constants:createDebugExpoConfig' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:checkDebugAarMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:compileDebugAidl' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:compileDebugJavaWithJavac' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:compileDebugRenderscript' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about
this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:compileDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this
problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:createDebugCompatibleScreenManifests' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:extractDeepLinksDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:generateDebugBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about
this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:javaPreCompileDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this
problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:mapDebugSourceSetPaths' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:mergeDebugResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this
problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:mergeDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:processDebugMainManifest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about
this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:processDebugManifest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:processDebugManifestForPackage' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details
about this problem.
- Gradle detected a problem with the following location: 'E:\SteveQueue\android'. Reason: Task ':expo-constants:createDebugExpoConfig' uses this output of
task ':app:processDebugResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what
order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
> Task :expo-modules-core:downloadBoost UP-TO-DATE
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'SM-G973F - 12' for :app:debug
Installed on 1 device.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD SUCCESSFUL in 35s
UPDATE:
I've downgraded RN to 0.70.5 (the compatible version for my expo version) and it's still the same
If you depend on Expo, you cant upgrade to 0.71 until they support this new version
Related
When I build my android app, I get this error message:
Task :react-native-screens:compileReleaseKotlin FAILED
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: /Users/vagrant/.gradle/caches/transforms-3/1811d0365a09e856e56e835cbefa53ec/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.0.
How can I fix this?
I tried to extend the version from 1.4.0 to 1.6.0 but I receive the following error:
> Task :app:mergeReleaseNativeLibs FAILED
Execution optimizations have been disabled for task ':app:mergeReleaseNativeLibs' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/aalarcony/work/diampark/digipark_react_app/android/app/build/intermediates/merged_jni_libs/release/out'. Reason: Task ':app:mergeReleaseNativeLibs' uses this output of task ':app:copyReleaseBundledJs' without declaring an explicit or implicit dependency. Th
So I was able to get my project to build by following these instructions on the react-native-screens GitHub. Basically I just added this to my build.gradle file:
buildscript {
ext {
kotlinVersion = "1.6.0"
}
}
Still wish I knew why it has been working for a months and all of a sudden it broke!
When compiling my Android React Native app, I get the following errors related to node modules I reference.
> Task :app:bundleDevJsAndAssets
Execution optimizations have been disabled for task ':app:bundleDevJsAndAssets' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-async-storage_async-storage:mergeDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-async-storage_async-storage:packageDebugAssets' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-async-storage_async-storage:packageDebugRenderscript' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-async-storage_async-storage:writeDebugAarMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-community_netinfo:compileDebugAidl' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-community_netinfo:compileDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-community_netinfo:mergeDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-community_netinfo:packageDebugAssets' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
- Gradle detected a problem with the following location: '/Userpath/toapp'. Reason: Task ':app:bundleDevJsAndAssets' uses this output of task ':react-native-community_slider:mergeDebugShaders' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Does anyone know if these errors are caused by the packages themselves, or if I need to explicitly reference them in my java files?
I recently upgrade to Android Gradle 7.3.3 from 4.0. I didn't have these errors before
I'm getting the following error when I try to build the project using $ react-native run-android.
> Task :react-native-device-info:compileDebugJavaWithJavac FAILED
/Users/user/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:31: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
/Users/user/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:838: error: cannot find symbol
#Nullable Object data) {
^
symbol: class Nullable
location: class RNDeviceModule
Note: /Users/ammiel/Desktop/mobile/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
I have jetify running postinstall and have
android.useAndroidX=true
android.enableJetifier=true
in my gradle.properties.
Been lurking at many pages/github pages with no success :/ Any help is appreciated!
Other info:
react-native: 0.59.10
react-native-device-info: 5.6.1
I faced the same problem like you!
But I managed to solve it by just adding the dependencies.
yarn add react-native-device-info
Wolla! The app is now running.
for that problem, one way is that you can update the new `react-native-device-
info` to solve the problem.
it releases note give the version which support androidx
2.3.0
feat: AndroidX support (backwards/forwards compatible) (https://github.com/react-native-community/react-native-device-info/pull/733)
fix: isTablet() Android using Google-recommended / robust style (https://github.com/react-native-community/react-native-device-info/pull/730)
the second way is to change the code manually.
the reason is that the android studio does not translate it to androidX API, so it reports errors. so you have to replace them manually or use the newest
the version which had changed to android.
Besides them, you can see this question, it may help you
I created an empty project and added appcompat-v7-26.1.0 support. I'm getting many errors like that:
C:\Users\username.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\e0aabf040e64856c88683f1511ddf095\res\layout\tooltip.xml: error: file not found.
which lead to:
Error: java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
I can solve it by adding property in gradle.properties file
android.enableAapt2=false
... but this is rather workaround than fixing the cause. If you take a look at this missing file path it seems quite long so I was wondering if the path length may be the problem as posted for other issues here. Unfortunately I don't know how can I changed it as most of the length is inside the gradle directory, so even if I change GRADLE_USER_HOME path (C:\Users\username\.gradle in my case) it's not a big profit.
I also tried to set
android.enableBuildCache=true # false didn't work as well
android.buildCacheDir =c:\\temp\\
but with no luck. I'd appreciate a helping hand or any tip in this case.
Here is what I changed In build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.4.3'
}
issure here:
https://issuetracker.google.com/issues/36972228
I had similar issue.
Changing gradle runtime from Gradle 4.4.1 to Gradle 4.1 helped.
(no changes in dependencies, if you use Jenkins make sure that environment variables updated correctly gradle --version)
It looks like the problem is gradle is looking in C:\Users\username.gradle\caches for the cached appcompat libraries. I'm assuming that username.gradle doesn't exist? Or is that a typo?
In any case, I had a similar issue, and specifying the gradle user home directory fixed it. In my case, gradle was looking inside C:\Windows\System32\config\systemprofile, and not finding the cache because it didn't exist.
I set an environment variable for GRADLE_USER_HOME so that gradle would cache things in a set location. See this question for a little more detail.
I am getting Task 'jar' is ambiguous in root project 'ProjectName'.
Candidates are: 'jarDebugClasses', 'jarReleaseClasses'.
while i run ./gradlew clean jar
can anybody help me out.
The error information basically says what is wrong: gradle cannot determine which task you are trying to run as jar is short for both jarDebugClasses as well as jarReleaseClasses. Replacing jar with jarR will solve the ambiguity (if you want to trigger the jarReleaseClasses task - use jarD for jarDebugClasses).