A gradle project configured with wrapper version 3.5. This gradle wrapper version works properly when import as project in Intelij IDEA 2017.1 and IDEA war artifact are available.
I tried to update gradle wrapper version to 4.0.2 and IDEA could not configure artifacts, it shows this Warning:
Warning:<i><b>root project 'dummy-trunk': Web Facets/Artifacts will not be configured properly</b>
Details: org.gradle.internal.typeconversion.UnsupportedNotationException: Cannot convert the provided notation to a File or URI: .
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A URI or URL instance.</i>
Maybe someone with the same problem?
I don't know how to get more info about the warning.
I tried to run > gradlew idea -d but this debug ouput do not show the warning.
Solved with IDEA 2017.2.1 + Gradle Wrapper 4.0.2
Thx to #CrazyCoder for your suggestion.
I have same problem.
(*) Update to IntelliJ IDEA 2017.2.5
(*) Use Gralde 4.2.1
(*) Use Gradle local, use mavenLocal()
This is a sample (a part of file build.gradle)
buildscript {
ext {
springBootVersion = '2.0.0.M5'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
Related
I've created a KMM project, and also an Xcode project with a build phase that calls ./gradlew embedAndSignAppleFrameworkForXcode. It runs successfully, but generates a .framework, not an .xcframework; and we really need the latter for modern Xcode.
Am i missing something? I read that modern versions of kotlin can generate the xcframework directly, but i'm not sure how. Is there a gradle task for this?
Thanks so much :)
According to Kdoctor, I have:
Xcode 14.1
Android studio 2021.3
Kotlin Plugin: 213-1.7.20
Kotlin MM plugin: 0.5.1(213)-60
You should declare your XCFrameworks, then it'll register three tasks for you.
assembleXCFramework, assembleDebugXCFramework, and assembleReleaseXCFramework.
Here is an example of build.gradle:
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
plugins {
kotlin("multiplatform")
}
kotlin {
val xcf = XCFramework()
val iosTargets = listOf(iosX64(), iosArm64(), iosSimulatorArm64())
iosTargets.forEach {
it.binaries.framework {
baseName = "shared"
xcf.add(this)
}
}
}
For more information, visit kotlin docs.
I have a live react native app, which was working fine. But now I need to made some changes to it but I am unable to do so after new updates and new gradle version. I have tried on multiple PCs and workspaces but all are of no use same error on every system pops up. giving some errors which are as under and attached screenshot.
FAILURE: Build failed with an exception.
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: ':react-native-alarm-clock', ':react-native-webview'
What went wrong:
Execution failed for task ':invertase_react-native-apple-authentication:compileDebugKotlin'.
Screenshot of the error
another Screenshot of the error
I have a live react native app, which was working fine. But now I need to made some changes to it but I am unable to do so. I have tried on multiple PCs and workspaces but all are of no use same error on every system pops up.
add kotlin version in you android/build.gradle
buildscript {
ext {
...
kotlin_version='1.6.0' //add This change version with your installed kotlin version
...
}
repositories {
google()
mavenCentral()
}
dependencies {
...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" //add This
...
}
}
Just go to build.gradle(Project:yourProjectName)
change
Plugin {
...
id 'org.jetbrains.kotlin.android' version '1.4.x' apply false
...
}
To
Plugin {
...
id 'org.jetbrains.kotlin.android' version '1.6.0' apply false
...
}
Note: Error may be different but if you are getting any error when taking android build without any changes in code for past two days
My Error - Failed to install the app. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
error Failed to install the app. Make sure you have the Android development environment set up:
Error: Command failed: ./gradlew app:installDebug
-PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where: Build file '/Users/....../node_modules/react-native-month-year-picker/android/build.gradle' line: 115
* What went wrong: A problem occurred configuring project ':react-native-month-year-picker'.
> Could not resolve all files for configuration ':react-native-month-year-picker:implementation'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-month-year-picker
> Cannot choose between the following variants of com.facebook.react:react-native:0.71.0-rc.0:
- debugVariantDefaultRuntimePublication
- releaseVariantDefaultRuntimePublication
All of them match the consumer attributes:
- Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.71.0-rc.0:
The build failures for Android was due to the publish of the React Native version 0.71.0-rc0.
Note: Error may be different but this would be the solution if you are getting android build failures without any changes in code for past two days
before trying these methods please revert back every changes you have done : https://stackoverflow.com/a/74371195/10657559
Method 1
Add this fix to your android -> build.gradle file as follows:
buildscript {
// ...
}
allprojects {
repositories {
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
// ...
}
}
What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules
Method 2
If your gradle doesn't support above, then add this to your android -> build.gradle file as follows:
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
buildscript {
// ...
}
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
// ...
}
Ref: Fix and updates on Android build failures happening since Nov 4th 2022 #35210
Adding on to the voted answer to do some knowledge sharing.
To reiterate, as #Thanhal has posted, the solution and official explanation can be found here: Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.
The biggest question I needed answer following the error was:
After specifying my react-native version in package.json, why does my project still download another react-native version?
I even used npm install --save-exact to ensure I am getting the correct version
The error message I was given left me even more confused:
The class is loaded from ~/.gradle/caches/transforms-3/9a8c596b7e1788d5bad7c80991eefff1/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
e: .../node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt: (351, 32): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
Somehow Kotlin became an issue for me as well.
Who / What is asking for the latest react-native?
For my case, the issue here wasn't about the version of react-native my project is using. It was about what my libraries are using.
The react-native team had been shipping a Maven Repository inside the NPM package (node_modules/react-native/android/) up till 0.71.0-rc.0. Most of the libraries have their build.gradle configured to reference to this directory. This is done through declaring a custom repository in the libraries' build.gradle:
maven {
url "$rootDir/../node_modules/react-native/android"
}
But in the libraries' build.gradle files, more repositories are declared, which may look like this:
repositories {
maven {
url "$rootDir/../node_modules/react-native/android"
}
google()
mavenLocal()
mavenCentral()
}
Then, the dependency for the library is declared as so:
dependencies {
implementation 'com.facebook.react:react-native:+'
}
Because the "+" as version for the react-native dependency, Gradle will take the latest react-native version from the various declared repositories.
Since in the past react-native was shipped with npm package, the latest which Gradle will always take the react-native in node_modules. However, now that the react-native team is publishing the library to public repositories including MavenCentral, Gradle honours the "+" and take the version on MavenCentral instead.
Why did I get the Kotlin error?
My project uses an older version of react-native and as of version 0.68 react-native started using Kotlin version 1.6.10 (see the change history). So yes, the difference in react-native version would also result in Kotlin error.
Facebook has release bugfix versions for >=0.63. You can upgrade instead of apply the hotfix also.
https://github.com/facebook/react-native/issues/35210
This fix works:
Reason for Failures : The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 to Maven and because of which when the gradle is syncing its picking this 0.71.0-rc0 version of react-native rather then your current version of react-native.
Made it work without upgrading react-native version and by adding this in build.gradle, this works (hermes enabled or not, along with flipper too)
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
final snippet looks like this
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
gradle clean and rebuild after this fix. Then you can react native run android successfully.
What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules
Now,
There are some patch releases from react native for different versions, If you dont want to put this fix,
you can update your current react native version to the react native patch version as mentioned here
https://github.com/facebook/react-native/issues/35210
I'm working with IntelliJ 15.0.6, SpringBoot 1.4.3.RELEASE, Gradle 2.14 and Groovy 2.3.11.
I get the following message from IntelliJ:
I tried following from StackOverFlow, the official documentation and JavaCodeGeeks with no success.
This is my configuration file:
#Configuration
#ConfigurationProperties(prefix = "configuracoes")
class GeralConfiguration {
def proxyEndereco
def proxyPorta
}
And the relevant part of my application.yaml file:
configuracoes:
proxyEndereco: http://fake.com
proxyPorta: 8080
If I remove #ConfigurationProperties from my configuration file, the message disappears.
This is my build.gradle file:
buildscript {
repositories {
mavenLocal()
maven {url('http://repo.spring.io/plugins-release')}
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE")
classpath('org.springframework.build.gradle:propdeps-plugin:0.0.7')
}
}
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'propdeps'
apply plugin: 'propdeps-idea'
sourceCompatibility = 1.7
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-devtools")
optional("org.springframework.boot:spring-boot-configuration-processor")
compile('org.codehaus.groovy:groovy-all:2.3.11')
compile('com.machinepublishers:jbrowserdriver:0.17.3')
compile("org.im4java:im4java:1.4.0")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.spockframework:spock-core:1.1-groovy-2.4-rc-3")
}
compileJava.dependsOn(processResources)
compileGroovy.dependsOn(processResources)
Any ideas on what is going on and how I can fix this?
Unfortunately, the annotation processor is not supported with Groovy. You may want to report that IJ shouldn't show this warning with Groovy code.
#Stephane helped me find the answer.
Indeed annotation processor is not supported with Groovy but I didn't manage to get it to work inside src/main/java as well.
I found out that the classes subfolder inside build was marked as excluded by IntelliJ (I don't know why).
As I tried fixing issues one by one I was never getting success. When I performed all fixes at once and marked the classes subfolder as NOT excluded everything worked fine (although IntelliJ keeps showing me the error message).
Thanks to #Stephane for helping me.
I have an Android project that is now failing to build:
FAILURE: Build failed with an exception.
* Where:
Build file 'build.gradle' line: 28
* What went wrong:
A problem occurred evaluating root project 'X'.
> java.lang.NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The project was building fine with the following dependencies:
'com.android.tools.build:gradle:2.1.3'
'com.android.tools.build:gradle-experimental:0.7.3'
A coworker applied the updates offered by AndroidStudio. That changed the plugin versions to:
'com.android.tools.build:gradle:2.2.0'
'com.android.tools.build:gradle-experimental:0.8.0'
After this update, the project builds successfully on his development machine
(Windows 7) and on mine (Ubuntu 16.04). The error occurs on the Jenkins build
server (Ubuntu 16.04). I installed the available updates to the Android SDK components on the build server but the error persists.
A google search for "ToolingRegistryProvider" returns "Your search matches no documents".
The problem was resolved by deleting gradle's module cache on the build server and then letting the build re-download everything.
rm -r ~/.gradle/caches/modules-2
Adding my solution to this issue: I added jcenter() to the top-level repositories tag.
We use a Nexus server that hosts lots of libraries we use here at work. So when it tried to update the gradle plugin version, it tried to do so from the Nexus server and for some reason, the update pulled the correct version but with some changes, making the gradle version and the gradle plugin version not to be in sync. So by adding jcenter() the gradle plugin was updated correctly and this error vanished.
This error can come from not having the Google Maven Repository as a repository in your build.gradle file:
allprojects {
repositories {
google()
// If you're using a version of Gradle lower than 4.1, you must instead use:
// maven {
// url 'https://maven.google.com'
// }
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
See this link for more information.
I had the same experience with JetpackCompose compose multiplatform Project structure
android/
|
- build.gradle.kts
desktop/
|
- build.gradle.kts
common/
|
- build.gradle.kts
buildSrc/
|
- build.gradle.kts
Common required id("com.android.library")
But was getting NoClassFound errors
I had to add
buildSrc/build.gradle.kts
// ...
repositories{
mavenLocal()
mavenCentral()
google()
}
dependencies{
compileOnly("com.android.tools.build:gradle:7.0.4")
}
// ...
Also, make sure to have.
google() in the allprojects section or in specific build.gradle.kts files.
Class might actually be missing.