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

Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl. #4757

Closed
hadnet opened this issue Feb 19, 2019 · 36 comments

Comments

Projects
None yet
@hadnet
Copy link

commented Feb 19, 2019

Issue Description

Got this error just when I try to build for Android (on iOS is working fine):

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/jon/RN/RNNv2Firebase/node_modules/react-native/react.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.

Steps to Reproduce

  1. react-native init Project
  2. yarn add react-native-navigation

Environment

  • React Native Navigation version: 2.12.0
  • React Native version: 0.59.0-rc.2
  • Platform: Android
  • Device info: Nexus5X API28 x86
@ralexand56

This comment has been minimized.

Copy link

commented Feb 25, 2019

I'm getting the same error.

@tibbus

This comment has been minimized.

Copy link

commented Feb 27, 2019

same here, happens when I try to upgrade my app to React Native version: 0.59.0-rc.2 , cannot reproduce with a new/clean project.

@kimbui87

This comment has been minimized.

Copy link

commented Feb 28, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

@hadnet hadnet closed this Feb 28, 2019

@tibbus

This comment has been minimized.

Copy link

commented Feb 28, 2019

for me rc3 didn't solved the issue, but @kimbui87 solution did !

@linmiss

This comment has been minimized.

Copy link

commented Mar 13, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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 had solved it in Android, thanks

@shaundon shaundon referenced this issue Mar 14, 2019

Merged

[BPK-2295] Upgrade React Native to 0.59.0 #77

13 of 14 tasks complete
@vikaskbh

This comment has been minimized.

Copy link

commented Mar 14, 2019

@kimbui87 solution worked on RN-0.59.1

@ctrljs

This comment has been minimized.

Copy link

commented Mar 15, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

where do i paste the metro.config.js file ?? in which folder?

@marcelloJr

This comment has been minimized.

Copy link

commented Mar 15, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

Worked on react-native-cli: 2.0.1 and react-native: 0.59.1. Thanks bro

I didn't need to modify the file metro.config.js'

@theilgazcode

This comment has been minimized.

Copy link

commented Mar 18, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

Tried on react-native-cli: 2.0.1 and react-native: 0.59.1.
Gradle version: 4.10.1

It didn't work.

Task :react-native-maps:compileDebugRenderscript FAILED
Could not resolve all files for configuration ':react-native-maps:debugCompileClasspath'.
Could not resolve com.android.support:support-compat:25.2.0.
Could not resolve com.android.support:support-annotations:25.2.0.
Could not resolve com.android.support:support-core-utils:25.2.0.
Could not resolve com.android.support:support-fragment:25.2.0.
Could not resolve com.android.support:support-annotations:28.0.0.
Could not resolve com.android.support:support-compat:28.0.0.
Could not resolve com.android.support:support-core-utils:28.0.0.
Could not resolve com.android.support:support-fragment:28.0.0.
Could not resolve com.android.support:support-core-ui:28.0.0.
Could not resolve com.android.support:support-compat:25.2.0.
Could not resolve com.android.support:support-core-utils:25.2.0.
Could not resolve com.android.support:support-core-ui:25.2.0.
Could not resolve com.android.support:support-fragment:25.2.0.
Could not resolve com.android.support:support-annotations:26.1.0.
Could not resolve com.android.support:support-annotations:25.2.0.

BUILD FAILED in 1s
8 actionable tasks: 3 executed, 5 up-to-date
error Command failed: gradlew.bat app:installDebug

@jeronnex2

This comment has been minimized.

Copy link

commented Mar 21, 2019

having the same error now ....rn 0.59.1

flsilva added a commit to reflex-ui/reflex-ui that referenced this issue Mar 21, 2019

flsilva added a commit to reflex-ui/reflex-ui that referenced this issue Mar 21, 2019

@kunal886496

This comment has been minimized.

Copy link

commented Mar 22, 2019

Same Problem.

@kunal886496

This comment has been minimized.

Copy link

commented Mar 22, 2019

THIS HAPPENS :

Loading dependency graph, done.
Error: Unable to resolve module ./index from /Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/react-native/.: The module ./index could not be found from /Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/react-native/.. Indeed, none of these files exist:

  • /Users/c-kunal.chugh/Desktop/bizmanager-react/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)
  • /Users/c-kunal.chugh/Desktop/bizmanager-react/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 (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
    at /Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/lib/transformHelpers.js:261:42
    at Server. (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/Server.js:1038:41)
    at Generator.next ()
    at asyncGeneratorStep (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/Server.js:99:24)
    at _next (/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/metro/src/Server.js:119:9)
    ::ffff:127.0.0.1 - - [22/Mar/2019:11:02:23 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"
@ras-marques

This comment has been minimized.

Copy link

commented Mar 22, 2019

Same error as @kunal886496

alemor10 added a commit to CSCI-150-Lab2-Team13/Palmanac that referenced this issue Mar 23, 2019

@hoscahmet

This comment has been minimized.

Copy link

commented Mar 24, 2019

don't use run npm audit fix to fix them, or npm audit for details in your project. just npm install

@859988748

This comment has been minimized.

Copy link

commented Mar 27, 2019

I have the same issue. Updating gradle to 3.3.0 did address this issue. But gradle 3.3.0 has a bug. It can not resolve R file in my project. all of my layout file can not be resolved. I have to downgrade gradle to 3.2.1. But, this issue will happen again. How to fix this?

@kimbui87

This comment has been minimized.

Copy link

commented Mar 29, 2019

I'm using 0.59.0-rc.3
and solved by these steps:

  • 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'
  • 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)

where do i paste the metro.config.js file ?? in which folder?

You should put it in root - same level with App.js. But now RN 0.59 official version was release, it seems no need config metro anymore.

@iKronyck

This comment has been minimized.

Copy link

commented Mar 30, 2019

Thanks @kimbui87 working for me

@CliffWMiller

This comment has been minimized.

Copy link

commented Mar 30, 2019

I have the same issue as @859988748. I'm using react-native-maps and facing a similar build issue where the apparent working solution is to downgrade gradle to 3.2.1.

Here's a link to that issue: react-native-community/react-native-maps#2696

@859988748

This comment has been minimized.

Copy link

commented Apr 1, 2019

@CliffWMiller I solved it. You need to upgrade AS to 3.2.2 also. using the latest AS will work good with gradle 3.3.0. It cost me one day.

@nuclearWinters

This comment has been minimized.

Copy link

commented Apr 2, 2019

@CliffWMiller I solved it. You need to upgrade AS to 3.2.2 also. using the latest AS will work good with gradle 3.3.0. It cost me one day.

@859988748 Can you tell me what "AS" stands for? Thank you

@swcisel

This comment has been minimized.

Copy link

commented Apr 2, 2019

@859988748 Can you tell me what "AS" stands for? Thank you

Android Studio

@MarcoLLeite

This comment has been minimized.

Copy link

commented Apr 3, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

This not only helped me with using the latest version, but t also helped getting the vscode-react debugger back hitting breakpoints

@dmackinn

This comment has been minimized.

Copy link

commented Apr 3, 2019

@kimbui87 Thank you, your solution fixed this issue for me when upgrading from 0.57.4 to 0.59.3

@ManuelAlanis

This comment has been minimized.

Copy link

commented Apr 4, 2019

I'm using 0.59.0-rc.3
and solved by these steps:

  • 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'
  • 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)

where do i paste the metro.config.js file ?? in which folder?

Thanks @kimbui87 it's works for me

@vigneshsankar07

This comment has been minimized.

Copy link

commented Apr 4, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

Thanks, @kimbui87 It's Works fine for me.

@hariputranto

This comment has been minimized.

Copy link

commented Apr 5, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

what does it mean by removing node?

@kimbui87

This comment has been minimized.

Copy link

commented Apr 5, 2019

I'm using 0.59.0-rc.3
and solved by these steps:

  • 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'
  • 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)

what does it mean by removing node?

delete old node_modules, yarn install again to make sure new config above is applied

@mohshbool

This comment has been minimized.

Copy link

commented Apr 10, 2019

I did what @kimbui87 suggested, not the build is successful but the app keeps stopping (crashing), I'm using version 0.59.4. Does anybody know the solution to this? Thanks in anticipation

@wibav

This comment has been minimized.

Copy link

commented Apr 11, 2019

I did what @kimbui87 suggested, not the build is successful but the app keeps stopping (crashing), I'm using version 0.59.4. Does anybody know the solution to this? Thanks in anticipation

i solved my problem using this npm install — save “react-native-maps@jerolimov/react-native-maps#fix-rn59rc-compile-issues”

from: react-native-community/react-native-maps#2702

the problem is with React native 0.59+ that compile with compileSdkVersion 28 and maps use 26

@akem3g

This comment has been minimized.

Copy link

commented Apr 15, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

This solved the issue. Thank you so much!

@LukePenkava

This comment has been minimized.

Copy link

commented Apr 24, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

Hi, i tried this fix, but when i do that, i get this error:

Cannot find a version of 'com.android.support:support-compat' that satisfies the version constraints: 
   Dependency path 'MyProject-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.4' --> 'com.android.support:appcompat-v7:28.0.0' --> 'com.android.support:support-compat:28.0.0'
 Dependency path 'MyProject-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.4' --> 'com.android.support:appcompat-v7:28.0.0' --> 'com.android.support:support-core-utils:28.0.0' --> 'com.android.support:support-compat:28.0.0'
....

Any help appreciated.

@HarshaKoshila

This comment has been minimized.

Copy link

commented Apr 29, 2019

Magic answer
compileSdkVersion and buildToolsVersion inside in root build.gradle file and in react-native-admob build.gradle must be same

Just like:

 root/ build.gradle                                                           
            compileSdkVersion 28                                                        
            buildToolsVersion "28.0.3"     

.../ react-native-admob build.gradle 
            compileSdkVersion 28                                                        
            buildToolsVersion "28.0.3"                                                   
@jorrharris

This comment has been minimized.

Copy link

commented May 10, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

Running RN 0.59.8
Tried this and I get this message:
Execution failed for task ':app:processDebugResources'.
Android resource linking failed
C:\Users\jorrh.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\af8030e268737a93bc8a43fec0f8b818\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\Users\jorrh\Desktop\Projects\FitBoard\fitboard\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\Users\jorrh.gradle\caches\transforms-1\files-1.1\design-26.1.0.aar\a6db251e9fbe69fc08fb3996b591f32d\res\values\values.xml:159:5-202: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\jorrh.gradle\caches\transforms-1\files-1.1\design-26.1.0.aar\a6db251e9fbe69fc08fb3996b591f32d\res\values\values.xml:159:5-202: AAPT: error: resource android:attr/ttcIndex not found.

error: failed linking references.

@androsein

This comment has been minimized.

Copy link

commented May 12, 2019

I'm using 0.59.0-rc.3

and solved by these steps:

  • 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'
  • 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)

THIS WORKS FOR ME

@hugomejia

This comment has been minimized.

Copy link

commented May 17, 2019

I encountered this issue while upgrading a project from react-native:0.58.6 to 0.59.8, and thanks to @kimbui87, the solution was : 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' , so thanks a lot !!!!

@Fausto95 Fausto95 referenced this issue May 22, 2019

Closed

RN 0.59 #277

3 of 3 tasks complete
@lazymesh

This comment has been minimized.

Copy link

commented Jun 12, 2019

I had to change the buildscript object in build.gradle to match with the emulator sdk version as

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'

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

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.