C:WindowsSystem32myApp>react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: C:WindowsSystem32myAppandroidappbuildintermediatesresmergeddebug: error: directory does not exist.
Command: C:Userslucky.gradlecachestransforms-1files-1.1aapt2-3.2.1-4818971-windows.jarc713e2313c3021b524690512ee68b028aapt2-3.2.1-4818971-windowsaapt2.exe compile --legacy
-o
C:WindowsSystem32myAppandroidappbuildintermediatesresmergeddebug
C:WindowsSystem32myAppandroidappbuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
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
BUILD FAILED in 6s
9 actionable tasks: 1 executed, 8 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/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at runOnAllDevices (C:WindowsSystem32myAppnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:299:19)
at buildAndRun (C:WindowsSystem32myAppnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:135:12)
at isPackagerRunning.then.result (C:WindowsSystem32myAppnode_modulesreact-nativelocal-clirunAndroidrunAndroid.js:65:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
C:WindowsSystem32myApp>
Can you run react-native info
and edit your issue to include these results under the Environment section?
If you believe this information is irrelevant to the reported issue, you may write [skip envinfo]
under Environment to let us know.
Similiar error happens to me but giving different info:
Where:
Script 'E:ProjectsMyAwesomeProjectnode_modulesreact-nativereact.gradle' line: 95
What went wrong:
A problem occurred configuring project ':app'.
Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.
React Native 0.59.0-rc.1
info
React Native Environment Info:
System:
OS: Windows 10
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 4.95 GB / 15.95 GB
Binaries:
Node: 11.6.0 - E:NodeJSnode.EXE
Yarn: 1.13.0 - C:Program Files (x86)Yarnbinyarn.CMD
npm: 6.5.0-next.0 - E:NodeJSnpm.CMD
Yes, I am having the same error.
"ERROR: Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl."
I am also using React Native 0.59.0-rc.1
I am trying to implement React Hooks with React_Native.
Also using Typescript, Win10, I5, 16GB ram, latest versions of node, android studio etc.
Breaks during build following instructions from here: https://facebook.github.io/react-native/docs/getting-started.html
using the Building Projects from Native Code variant.
Error msg reads:
"FAILURE: Build failed with an exception.
Where:
Script 'C:UsersjohnfDesktopAwesomeAndroidProjectnode_modulesreact-nativereact.gradle' line: 95
What went wrong:
A problem occurred configuring project ':app'.
Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl."
We are automatically closing this issue because it does not appear to follow any of the provided issue templates.
馃憠 Click here if you want to report a reproducible bug or regression in React Native.
In gradle-wrapper.properties
change distributionUrl
to distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
and in root build.gradle
file change gradle classpath to this: classpath 'com.android.tools.build:gradle:3.3.0'
Even I am Facing issue with gradlew
` Android resource linking failed
C:UsersTeraBaap.gradlecachestransforms-1files-1.1appcompat-v7-28.0.0.aar5986f3588c6f2d411bca61164fea92caresvalues-v28values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:UsersTeraBaapReactNativeProjectsfoodieandroidappbuildintermediatesincrementalmergeDebugResourcesmerged.dirvalues-v28values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:UsersTeraBaap.gradlecachestransforms-1files-1.1drawee-1.10.0.aar75a166b6228244798e8765d877ab99bfresvaluesvalues.xml:3:5-58:857: AAPT: error: resource android:attr/fontVariationSettings not found.
C:UsersTeraBaap.gradlecachestransforms-1files-1.1drawee-1.10.0.aar75a166b6228244798e8765d877ab99bfresvaluesvalues.xml:3:5-58:857: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
`
App was running properly till yesterday and suddenly after adding a new libarary all messed up.
Please Help
Thanks @alexandrius. I am not getting the gradle error anymore I am now getting the following: (Again, this happens only after I install [email protected])
Error: Unable to resolve module
./indexfrom
C:UsersjohnfDesktopMyAwesomeProjectnode_modulesreact-nativescripts/.: The module
./indexcould not be found from
C:UsersjohnfDesktopMyAwesomeProjectnode_modulesreact-nativescripts/.`. Indeed, none of these files exist:
C:\Users\johnf\Desktop\MyAwesomeProject\node_modules\react-native\scripts\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
C:\Users\johnf\Desktop\MyAwesomeProject\node_modules\react-native\scripts\index\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
Though this is closed, thnx @alexandrius! This did the trick for me with following Environment:
React Native Environment Info:
System:
OS: Linux 4.15 Linux Mint 19.1 (Tessa)
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory: 542.54 MB / 31.35 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 11.10.0 - /usr/bin/node
Yarn: 1.13.0 - /usr/bin/yarn
npm: 6.8.0 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 27, 28
Build Tools: 27.0.3, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
npmPackages:
react: 16.8.1 => 16.8.1
react-native: 0.59.0-rc.2 => 0.59.0-rc.2
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
Can't wait for RN 0.59 (with hopefully hooks included ; )!
Edit: Wrote package.json
instead of Environment ^^.
Though this is closed, thnx @alexandrius! This did the trick for me with following Environment:
Can't wait for RN 0.59 (with hopefully hooks included ; )!
Edit: Wrote
package.json
instead of Environment ^^.
It can build package
it's not works on ubuntu 16 dev env, although i can build it but emulator error 500, like this image
@webnah, I'm following Ben's project too. lol. I'm on a Windows 10 machine :( and got the same screen you are showing with the same 500 error code. Frustrating to say the least
@webnah, I'm following Ben's project too. lol. I'm on a Windows 10 machine :( and got the same screen you are showing with the same 500 error code. Frustrating to say the least
I change to macos (PC installed) run-ios and the same error (benawad rnw tutorial) , the problem is they demo state in 0.59.x
anyway: rn 0.58.5 works
Same error on run-android
with RN 0.59.0-rc.2
Error: Unable to resolve module `./index` from `rnapp/node_modules/react-native/.`: The module `./index` could not be found from `rnapp/node_modules/react-native/.`. Indeed, none of these files exist:
* `rnapp/node_modules/react-native/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `rnapp/node_modules/react-native/index/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
at ModuleResolver.resolveDependency (rnapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
at ResolutionRequest.resolveDependency (rnapp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (rnapp/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
at rnapp/node_modules/metro/src/lib/transformHelpers.js:261:42
at Server.<anonymous> (rnapp/node_modules/metro/src/Server.js:1038:41)
at Generator.next (<anonymous>)
at asyncGeneratorStep (rnapp/node_modules/metro/src/Server.js:99:24)
at _next (rnapp/node_modules/metro/src/Server.js:119:9)
I got it running by following the official _Get Started_ guidelines for _Building Projects with Native Code_ Linux / Android - had to downgrade my Java Version to 8 for this to work - and applying @alexandrius "patch" to android/gradle/wrapper/gradle-wrapper.properties
- with com.android.tools.build:gradle:3.3.1
instead of 3.3.0
- and android/build.gradle
respectively.
My exact package.json
is:
{
"name": "random",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.1",
"react-native": "0.59.0-rc.2"
},
"devDependencies": {
"@types/react": "^16.8.4",
"@types/react-native": "^0.57.38",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"react-test-renderer": "16.8.1"
},
"jest": {
"preset": "react-native"
}
}
My package manager is yarn
. Have a look at my react-native info
in mine last comment for versions used.
Hope it helps anybody struggling : )!
There are issues with upgrading RN version. The easiest way to avoid issues is just to compare with "template" from react-native specific version branch. Here's the template from 0.59.0
https://github.com/facebook/react-native/tree/0.59-stable/template
Do cleanup after upgrading version.
rm -rf node_modules/
npm i
or just yarn
then start with
react-native start --reset-cache
If you have CocoaPods don't forget to
pod update
BTW I resolved issue by setting explicit (downgraded) metro version to 0.51.0: "metro": "0.51.0",
It seems that this issue is related to the metro bundler not resolving to the right paths, thus Unable to resolve module
...
Executing react-native start
on one terminal at the project directory and react-native run-android
on another terminal worked for me.
By the way, I got metro version 0.52.0
with react-native 0.59.0-rc.2
.
Does it works for anyone else?
@marcelovicentegc it doesn't work for me. I am still getting the Unable to resolve module
error. I am on a Windows 10 machine.
@webnah @ABQJuan
Copy file 'metro.config.js' in 0.59-stable/template to your project.
Remove node_modules
yarn install
and run-android again.
(And make sure version of metro in package.json "metro-react-native-babel-preset": "0.51.0" is the same with current metro's version)
I solved by above steps
Though this is closed, thnx @alexandrius! This did the trick for me with following Environment:
Can't wait for RN 0.59 (with hopefully hooks included ; )!
Edit: Wrotepackage.json
instead of Environment ^^.
It can build package
it's not works on ubuntu 16 dev env, although i can build it but emulator error 500, like this image
@webnah The same error was happening to me after applying what @alexandrius indicated. the solution after running react-native run-android
was to stop the command after the application was already running in the emulator and then run react-native start
and the problem went away.
After spending so much time.
Downgrading react-native version from 0.59.1 to 0.58.5 did it for me.
@shimesami solution works, downgrading react-native resolves the issue.
I suspect the real problem for me is that react-native-maps needs to be upgraded to uses newer libs?
@shimesami solution works for me as well.
It seems that this issue is related to the metro bundler not resolving to the right paths, thus
Unable to resolve module
...Executing
react-native start
on one terminal at the project directory andreact-native run-android
on another terminal worked for me.By the way, I got metro version
0.52.0
with react-native0.59.0-rc.2
.Does it works for anyonete selse?
paste /* eslint-env node */
at the top of metro.config.js
/* eslint-env node */
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
I was having similar issues, my antivirus was identifying things as false positive and blocking them. I've changed the antivirus. =P
In gradle-wrapper.properties
changedistributionUrl
todistributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
and in rootbuild.gradle
file change gradle classpath to this:classpath 'com.android.tools.build:gradle:3.3.0'
Love ya man, thanks!
Most helpful comment
In gradle-wrapper.properties
change
distributionUrl
todistributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
and in root
build.gradle
file change gradle classpath to this:classpath 'com.android.tools.build:gradle:3.3.0'