React-Native CodePush Build Failure - No matching configuration of project :react-native-code-push found - react-native

I am trying to enable codepush in my react native application. Using repo https://github.com/microsoft/react-native-code-push
I am facing build failure on the following Environment
Environment:
=============
react-native-code-push version:7.0.4
react-native version:0.65.0
Gradle version: 6.9
Does this reproduce on a debug build or release build? : both
Does this reproduce on a simulator, or only on a physical device?: during build, can't run it yet.
Hardware/OS: MacOS (M1 chipset), MacOS Monterey v12.0.1
According to documentation #https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-and-configuration-for-react-native-060-version-and-above-android
i am following these steps
npm install --save react-native-code-push
In your android/settings.gradle file, make the following additions at the end of the file:
(a)
...
apply from: file("../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
Also tried adding before the last line (though the documentation asks to add at the end of file)
(b)
...
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
apply from: file("../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
In your android/app/build.gradle file, add the codepush.gradle file as an additional build task definition underneath react.gradle:
...
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
...
Update the MainApplication.java file to use CodePush via the following changes:
...
// 1. Import the plugin class.
import com.microsoft.codepush.react.CodePush;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
// 2. Override the getJSBundleFile method in order to let
// the CodePush runtime determine where to get the JS
// bundle location from on each app start
#Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
};
}
Add the Deployment key to strings.xml:
<resources>
<string name="app_name">AppName</string>
<string moduleConfig="true" name="CodePushDeploymentKey">XXXXXXXX</string>
</resources>
Build output with step-2(a):
> Task :react-native-code-push:generateReleaseRFile FAILED
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.nimbusds, artifactId=nimbus-jose-jwt, version=5.1), toArtifact=Artifact(groupId=net.minidev, artifactId=json-smart), toArtifactVersionString=[1.3.1,2.3])
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.nimbusds, artifactId=nimbus-jose-jwt, version=5.1), toArtifact=Artifact(groupId=net.minidev, artifactId=json-smart), toArtifactVersionString=[1.3.1,2.3])
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-code-push:generateReleaseRFile'.
> Failed to notify dependency resolution listener.
> In project 'App' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1
.3.1,2.3]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart#[1.3.1,2.3], but json-smart version was 2
.3.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'App' depends on project 'react' which depends onto net.minidev:json-smart#{strictly 2.3}
-- Project 'App' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt#{strictly 5.1}
-- Project 'App' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt#5.1
For extended debugging info execute Gradle from the command line with ./gradlew --info :App:assembleDebug to see the
dependency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at http
s://github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to yo
ur build.gradle file.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.3.1
,2.3]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart#[1.3.1,2.3], but json-smart version was 2
.3.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends on project 'react' which depends onto net.minidev:json-smart#{strictly 2.3}
-- Project 'app' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt#{strictly 5.1}
-- Project 'app' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt#5.1
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
* 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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 48s
Build Output with step-2(b):
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
> Could not resolve project :react-native-code-push.
Required by:
project :app
> No matching configuration of project :react-native-code-push was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'react-native-camera' with value 'mlkit', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
* 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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 7s

Related

React-native yarn android #homee/react-native-mapbox-navigation Execution failed for task ':homee_react-native-mapbox-navigation:compileDebugKotlin'

I have installed node package #homee/react-native-mapbox-navigation for quick turn-by-turn navigation in my react-native android app, but when I run yarn android, got below error:
> Configure project :homee_react-native-mapbox-navigation
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
> Task :homee_react-native-mapbox-navigation:compileDebugKotlin
> Task :homee_react-native-mapbox-navigation:compileDebugKotlin FAILED
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
72 actionable tasks: 2 executed, 70 up-to-date
e: /home/cipto/Code/mapbox/mapboxnav/node_modules/#homee/react-native-mapbox-navigation/android/src/main/java/com/homee/mapboxnavigation/MapboxNavigationManager.kt: (11, 19): Unresolved reference: maps
.
.
.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':homee_react-native-mapbox-navigation:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
have been following the gude in readme at https://github.com/homeeondemand/react-native-mapbox-navigation, by the way I installed the package which come from the github (latest version 2.00 master branch) by running this:
yarn add homeeondemand/react-native-mapbox-navigation#master
I have also try that package and got the same error, after I upgrade the kotlin version into 1.6.0, the error went away.

ERROR ----> Task :expo-permissions:compileDebugKotlin FAILED

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
The Kotlin plugin was loaded in the following projects: ':expo-av', ':react-native-agora'
Task :expo-permissions:compileDebugKotlin FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
175 actionable tasks: 2 executed, 173 up-to-date
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (12, 50): Unresolved reference: R
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (19, 52): Unresolved reference: R
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (40, 36): Unresolved reference: R
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':expo-permissions:compileDebugKotlin'.
Compilation error. See log for more 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
BUILD FAILED in 17s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (12, 50): Unresolved reference: R
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (19, 52): Unresolved reference: R
e: /Users/development/Projects/myapp/node_modules/react-native-unimodules/node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (40, 36): Unresolved reference: R
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':expo-permissions:compileDebugKotlin'.
Compilation error. See log for more details
My thoughts are this is a versioning issue. I solved this by changing the versions of buildTools, compileSdk and targetSdk.
Go to your android/build.gradle file and change the following values:
buildToolsVersion = "29.0.3" to buildToolsVersion = "30.0.0"
compileSdkVersion = 29 to compileSdkVersion = 30
targetSdkVersion = 29 to targetSdkVersion = 30
This sure saved me hours of stress. Let me know if it worked for you.
Edit:
I'm editing this answer to make it future proof, hopefully. Whenever this error occurs, check that the buildToolsVersion, compileSdkVersion and targetSdkVersion are using the latest the versions.
This also means you need to make sure your Android SDK, gradle or Android Studio is up-to-date.
Note: If you created your react-native project using the npx command and on the latest Android Studio, you might not need to specify the buildToolsVersion. For instance, at the time of editing this answer, buildToolsVersion is on 30.0.2 and my project is using 30.0.0. During build, Android Studio ignored my set version and used the latest.
A new issue is reported in older RN version. Here's the issue and resolution: https://github.com/facebook/react-native/issues/35210
I had a very similar issue. My solution was to go to open the file ./android/app/gradle/gradle-wrapper.properties
i then changed distributionUrl to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
also changed ./android/build.gradle
dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
If you created a project using 'npx', delete 'expo' dependencies from package.json. It works for me.
I got slightly different error message, which was
What went wrong: Execution failed for task ':expo-permissions:compileDebugKotlin'.
After matching /android/build.gradle's kotlinVersion to android studio's kotlin version it worked.
You can have some error in your android/ios folder setup, remove folder and type expo-prebuild in your console. It generates new android and ios folders with proper settings. I had a lot of problems like that after upgrading my expo sdk.

react native - could not resolve all dependencies for configuration ':classpath'

I was working on my react native app, when suddenly there was a Javascript React versions mismatch.
When I searched around for a way to fix it, someone suggested to call the command react-native upgrade
After running the command, it completely reset my android app package. I had to do react-native install <my-react-native-packages> for all libraries that I had included as I couldn't find another way to do so.
After doing so, this is the error I'm receiving upon calling react-native run-android
Scanning folders for symlinks (9ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'CustomApp'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.1.2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar
Required by:
:CustomApp:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Additional error with --stacktrace
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'CustomApp'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:57)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':classpath'.
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.rethrowFailure(DefaultLenientConfiguration.java:62)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.rethrowFailure(DefaultResolvedConfiguration.java:36)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyConfigurationResolver$FilesAggregatingResolvedConfiguration.rethrowFailure(SelfResolvingDependencyConfigurationResolver.java:112)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolvedConfiguration.rethrowFailure(ErrorHandlingConfigurationResolver.java:189)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:669)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:293)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.initialization.DefaultScriptHandler.getScriptClassPath(DefaultScriptHandler.java:69)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.defineScriptHandlerClassScope(DefaultPluginRequestApplicator.java:186)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:75)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:157)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
... 43 more
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:3.1.2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar
Required by:
:CustomApp:unspecified
at org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult.notFound(DefaultBuildableComponentResolveResult.java:38)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:88)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:59)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolversChain$ComponentMetaDataResolverChain.resolve(ComponentResolversChain.java:80)
at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:44)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.resolve(DependencyGraphBuilder.java:564)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.getMetaData(DependencyGraphBuilder.java:574)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:260)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:234)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:141)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:90)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:80)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.java:80)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:41)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:39)
at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:91)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyConfigurationResolver.resolve(SelfResolvingDependencyConfigurationResolver.java:40)
at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolve(ShortCircuitEmptyConfigurationResolver.java:52)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolve(ErrorHandlingConfigurationResolver.java:43)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:372)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:347)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:340)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:667)
... 53 more
BUILD FAILED
I have no idea how to resolve this or undo this. Can anyone suggest something to fix this problem?
Can you try this below (for react-native version <0.60).
Delete android, ios and node modules folder
run > npm install /to get the node modules folder
> react-native upgrade //to get both android and ios folder
> react-native link //to link the libraries
> react-native run-android/run-ios
Sounds like an issue with your app's build.gradle file where it's using an old version of the gradle build tools.
I would recommend opening up your project in Android Studio and then open up the projects's build.gradle file located here: RN-Project/android/build.gradle
You'll find the gradle tools version within buildscript and it'll look something like this.
buildscript {
repositories {
jcenter()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'de.undercouch:gradle-download-task:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
If it is outdated, it'll highlight the com.android.tools.build:gradle:2.2.2 part and suggest what build tools version you should update to. Hopefully after updating it, it should work.
In my case, I just disconnected my office proxy and it started working. May be my office proxy was blocking some url's.
Make Sure you have done the following things:
Install Android Studio
Install the Android SDK
Configure the ANDROID_HOME environment variable
visit https://facebook.github.io/react-native/docs/getting-started.html to get the proper guideline

Could not find kotlin-gradle-plugin for Kotlin script Gradle

build fails, classpath error:
thufir#dur:~/NetBeansProjects/kotlinShadowJar$
thufir#dur:~/NetBeansProjects/kotlinShadowJar$ gradle clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'kotlinShadowJar'.
> Could not resolve all files for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:.
Searched in the following locations:
file:/home/thufir/.gradle/caches/4.3.1/embedded-kotlin-repo-1.1.51-1/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
file:/home/thufir/.gradle/caches/4.3.1/embedded-kotlin-repo-1.1.51-1/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
https://repo.gradle.org/gradle/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
https://repo.gradle.org/gradle/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
Required by:
project :
* 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 1s
cat build.gradle.kts:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
mavenCentral()
gradleScriptKotlin()
}
dependencies {
classpath(kotlinModule("gradle-plugin"))
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
}
}
apply {
plugin("kotlin")
plugin("com.github.johnrengelman.shadow")
}
repositories {
mavenCentral()
}
val shadowJar: ShadowJar by tasks
shadowJar.apply {
manifest.attributes.apply {
put("Implementation-Title", "Gradle Jar File Example")
put("Implementation-Version" version)
put("Main-Class", "com.mkyong.DateUtils")
}
baseName = project.name + "-all"
}
The buildfile was a direct copy of a working build. The context is getting started with Kotlin script Gradle. So far as I can tell the script should be good.
Note that I'm not using intelli-J, this is strictly from the CLI with Kotlin script Gradle.
perhaps it's something quite simple, like "plugin" versus "plugins"...
Looking at the error logs, you can see the plugin version request:
Searched in the following locations:
file:/home/thufir/.gradle/caches/4.3.1/embedded-kotlin-repo-1.1.51-1/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
file:/home/thufir/.gradle/caches/4.3.1/embedded-kotlin-repo-1.1.51-1/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
https://repo.gradle.org/gradle/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.pom
https://repo.gradle.org/gradle/repo/org/jetbrains/kotlin/kotlin-gradle-plugin//kotlin-gradle-plugin-.jar
You can see that a version is not requested on each plugin request because they are looking for kotlin-gradle-plugin-.jar.
If you look at the source, you will also see that kotlinModule is deprecated.
I would recommend a few different changes to improve the build script:
Using the Gradle wrapper (./gradlew
Specify a version for your kotlinModule until you upgrade your Gradle version - kotlinModule("gradle-plugin", "1.1.51")
Use the plugins {} block instead of buildscript for plugins

Adding sub module to project causing gradle build failures in Android studio 3.0 with gradle version 4.1

I added sub module library vertical-stepper-form version 0.9.8, while I set dependency of this library on my app module. I was able to do it successfully.
I am using Android Studio 3.0 with gradle version 4.1, few of the classes in project are in kotlin and others in java
When I started gradle sync it gave me this error. The gradle is not building and showing below issues :
/*********************************/
Information:Gradle tasks [:vertical-stepper-form:generateDebugSources,
:vertical-stepper-form:generateDebugAndroidTestSources,
:vertical-stepper-form:mockableAndroidJar,
:app:generateInstallDebugSources,
:app:generateInstallDebugAndroidTestSources, :app:mockableAndroidJar]
D:\Devavrata\project/package/src/main/res/abc.xml Error:error:
attribute 'com.spireon.install:src' not found.
D:\Devavrata\AbcProject\abc-Android\app\build\intermediates\incremental\mergeInstallDebugResources\stripped.dir\layout\activity_main.xml
Error:attribute 'com.spireon.install:src' not found. Error:failed
linking file resources. Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error:
check logs for details Error:Execution failed for task
':app:processInstallDebugResources'.
Failed to execute aapt Information:BUILD FAILED in 24s Information:7 errors Information:0 warnings Information:See complete output in
console
/********************************/
What I have already tried :
I tried with changing import lines in xml also changing the android:src and srcCompat properties. Along with build/project cleaning and invalidating the cache.
Changing this line in gradle.properties
android.enableAapt2=false
Let me know if anyone has faced this issue