Execution failed for task ':app:mergeDebugNativeLibs' while running react-native app - react-native

While running react native app I am getting following error:
`
Task :app:mergeDebugNativeLibs 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.9.2/userguide/command_line_interface.html#sec:command_line_warnings
574 actionable tasks: 2 executed, 572 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path 'lib/armeabi-v7a/libfbjni.so' from inputs:
- C:\Users\nouman.gradle\caches\transforms-3\6ef14503de3c85fa1ab2aba364d580cc\transformed\jetified-react-native-0.71.0-rc.0-debug\jni
- C:\Users\nouman.gradle\caches\transforms-3\64faf76bb2f0142d731347d7bfff47d4\transformed\jetified-fbjni-0.3.0\jni
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
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 32s
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path 'lib/armeabi-v7a/libfbjni.so' from inputs:
- C:\Users\nouman.gradle\caches\transforms-3\6ef14503de3c85fa1ab2aba364d580cc\transformed\jetified-react-native-0.71.0-rc.0-debug\jni
- C:\Users\nouman.gradle\caches\transforms-3\64faf76bb2f0142d731347d7bfff47d4\transformed\jetified-fbjni-0.3.0\jni
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
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 32s
at makeError (D:\BayQi-Customer-Mobile-App\node_modules\execa\index.js:174:9)
at D:\BayQi-Customer-Mobile-App\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\BayQi-Customer-Mobile-App\node_modules\react-native\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\BayQi-Customer-Mobile-App\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
`
I am trying to run my react native app in physical device but getting this error.
It was running okay but suddenly has stopped working

UPDATED ANSWER
📢 Patches for >= 0.63 We have prepared releases for all the main versions of react-native with an hotfix:
🛳 0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5
🛳️ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7
🛳 0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5
🛳️ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5
🛳️ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5
🛳️ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3
🛳️ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4
🛳️ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start working again.
Source https://github.com/facebook/react-native/issues/35210
OLD ANSWER
Add this to your android/build.gradle,
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())
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
If that does not work for you (with the dynamic version), then hard code your version in:
PLEASE BE CAREFUL TO MOVE THIS VERSION WHEN YOU UPDATE REACT-NATIVE
allprojects {
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:<your version>'
}
}
repositories {
// ...
}
}
Check this for more updates https://github.com/facebook/react-native/issues/35204

add this to your app/build.gradle
android {
// yout existing code
packagingOptions {
pickFirst '**/libc++_shared.so'
pickFirst '**/libfbjni.so'
}
}

// Top-level build file where you can add configuration options common to all sub-projects/modules
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// ...
}
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"
+ }
+ }
+ }
// ...
}
}

New patch release for react-native
https://github.com/facebook/react-native/issues/35210#:%7E:text=We%20have%20prepared%20releases%20for%20all%20the%20main%20versions%20of%20react%2Dnative%20with%20an%20hotfix%3A
just update your package.json with latest react-native version

This helped me to resolve the issue.
This is happening because all the templates reference the React Native dependency by range, like implementation com.facebook.react:react-native:+. Usually this dependency gets resolved from the local Maven repo in ./node_modules/react-native/android but, since it has been published to Maven Central, it's now grabbing the very latest RC.
You can resolve this problem by forcing the React Native dependency to the version you expect with something like this implementation com.facebook.react:react-native:0.68.2!! in your app's Gradle file. The !! is shorthand for restricting Gradle from upgrading if your project or its transitive dependencies depend on a newer version. AFAIK Maven Central is immutable and the published dependency can't removed so this might be the only solution.
File: android/app/build.gradle
dependencies {
implementation 'com.facebook.react:react-native:0.67.2!!'
}
Reference: https://github.com/facebook/react-native/issues/35204

Workaround: I have made the following changes & It is working:
In gradle-wrapper.properties file, change gradle version
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
In project level build.gradle file, add following lines:
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0")
}
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"
}
}
}
}
configurations.all {
resolutionStrategy {
force 'androidx.core:core:1.6.0'
force 'androidx.core:core-ktx:1.6.0'
}
}
In app level build.gradle, add these dependecies:
implementation 'androidx.core:core-ktx:1.6.0',
implementation 'androidx.core:core:1.6.0'

Add following lines inside the android>build.gradle file -
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"
}
}
}
}
This issue occurred from November 4th 2022. See the reference: https://github.com/facebook/react-native/issues/35210

Related

Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED

i got a bug when i build react native apk. last week I built no error. but now an error occurs, even though there is no new package that I installed.
Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-async-storage_async-storage:releaseCompileClasspath'.
> Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar
i wish i could build apk
hope this can help you [FIXED] Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found
in my case it was because of using maven's react native version how I fixed it.
android/build.gradle
mavenCentral()
jcenter()
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central
as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }

A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction

My react native project build fails somehow because of this error:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs:
- C:\Users\Antonio\.gradle\caches\transforms-3\7cca348744e25f57fc2d9f871aa73c9a\transformed\jetified-react-native-0.71.0-rc.0-debug\jni\arm64-v8a\libfbjni.so
- C:\Users\Antonio\.gradle\caches\transforms-3\08b0f5c7017bf081f79b63ea5b053dc0\transformed\jetified-fbjni-0.3.0\jni\arm64-v8a\libfbjni.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
Anybody got a clue what could cause the build to fail? I haven't edited any build file and/or removed/installed/upgraded new packages thanks
For me this worked (after reading Tony's link), my version of react was 0.66.0
Changed this file android\app\build.gradle
implementation "com.facebook.react:react-native:+" // From node_modules
to
implementation "com.facebook.react:react-native:0.66.0!!" // From node_modules
Short answer:
in your android/app/build.gradle
change
implementation 'com.facebook.react:react-native:+'
to ---> (replace 0.67.2 with your current react native version)
implementation 'com.facebook.react:react-native:0.67.2!!'
Long answer:
This is happening because all the templates reference the React Native dependency by range, like implementation 'com.facebook.react:react-native:+'. Usually this dependency gets resolved from the local Maven repo in ./node_modules/react-native/android but since it has been published to Maven Central it's now grabbing the very latest RC.
You can resolve this problem by forcing the React Native dependency to the version you expect with something like this implementation 'com.facebook.react:react-native:0.67.2!!' in your app's Gradle file. The !! is shorthand for restricting Gradle from upgrading if your project or its transitive dependencies depend on a newer version.
work for me, if your react native application version >= 0.63 you can update the patch version which should fix your problem.
link: https://github.com/facebook/react-native/issues/35210#:~:text=We%20have%20prepared%20releases%20for%20all%20the%20main%20versions%20of%20react%2Dnative%20with%20an%20hotfix%3A
if not just go to android/build.gradle and then in the allprojects object add the following code with the current version of react native in package.json
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:CURRENT_VERSION_OF_REACT_NATIVE'
}
}
Here's a workaround to fix this problem if you are not using latest version of react-native.
https://github.com/facebook/react-native/issues/35210
Go to android folder -> build.gradle file -> inside allprojects object and add following code. Add react native version from node_modules -> react-native -> package.json // "version": "0.68.2".
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.68.2'
}
}
See fb/rn#35204
This is the Official recommended fix!
Found through this issue: https://github.com/facebook/react-native/issues/35210.
Copied from this PR here
For my RN 0.66.0 project I only had to add theses lines:
allprojects {
repositories {
exclusiveContent {
// Official recommended fix for Android build problem with React Native versions below 0.71
// https://github.com/facebook/react-native/issues/35210
// TODO: remove this exclusiveContent section when we upgrade to React Native 0.71 (or above)
// copied from https://github.com/Scottish-Tech-Army/Volunteer-app/pull/101/commits/40a30310ee46194efbaf1c07aef8a0df70231eeb
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
}
}
I had the same issue. There is a new patch for react-native now so update it in your package.json.
Mine is
"react-native": "^0.70.3"
and I changed it to
"react-native": "^0.70.5"
which worked for me
The answer lies here depending on the version of your react native. Patches are available for RN version 0.63 and up
https://github.com/facebook/react-native/issues/35210
Tips:
Don't just update react-native package, do an npm install
Clean gradle before running the app
Only add the code below IF your react native version is < 0.63
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())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
}

How to cache gradle plugin dependencies?

I'm having a gradle script to execute Kotlin code with the gradle application plugin:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation platform("org.jetbrains.kotlin:kotlin-bom")
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
// Some other deps
}
sourceSets {
main.kotlin.srcDirs += '.'
}
application {
mainClassName = 'MainKt'
}
What I would like to achieve: During the docker container startup I would like to load all the necessary dependencies with gradle build --build-cache command and be able to run gradle run --offline in the offline mode when the image is ready.
What do I have at the moment: I'm getting No cached version of org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.10 available for offline mode. error because plugin dependencies are not being cached during the build phase.
Any ideas what I can do to force gradle to cache not only listed dependencies but also dependencies required by plugins?
Adding the plugin dependency to the dependency list explicitly helped me to resolve this issue:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable" // <-- this solves the problem
// Some other deps
}
I hope this answer will be helpful! Although the use-case is pretty narrow.

React-Native Android Build Failure: Execution failed for task ':app:processDebugResources'. Failed to process resources

I cannot figure out what is wrong with the build. I tried the common solutions of running ./gradlew clean as well as adding the android.enableAapt2=false to the gradle.properties.
The google-services.json folder is at the /android/app level.
Im at a loss right now as to how to get past this one.
If I forgot to include something useful please lmk and I will update.
Cheers
Error Output
Configure project :app
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Configure project :react-native-google-analytics-bridge
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Configure project :react-native-radar
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Task :app:processDebugGoogleServices
Parsing json file: /Users/kyletreman/18F/courier_test_app/android/app/google-services.json
/Users/kyletreman/.gradle/caches/transforms-1/files-1.1/appcompat-v7-23.0.1.aar/64df69838d7c555de168bdcf18f3be5c/res/values/values.xml:113:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/kyletreman/.gradle/caches/transforms-1/files-1.1/appcompat-v7-23.0.1.aar/64df69838d7c555de168bdcf18f3be5c/res/values/values.xml:113:5-69: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to process resources, see aapt output above for 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 2s
50 actionable tasks: 3 executed, 47 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
/android/app/build.gradle
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.courier_test_app.app"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:support-v13:27.1.1'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-radar')
implementation project(':react-native-google-analytics-bridge')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
/android/build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.0.0'
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
From the error log I can see that appcompat-v7-23.0.1 is still being used. So, it would probably help to update resolutionStrategy:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
force 'com.android.support:appcompat-v7-23.0.1'
}
}
Also you need to place that resolution strategy block in your app/build.gradle
Fixed
I was able to get help from someone familiar with the native side and he helped me sort out quite a few errors.
implementation order matters, this was the order that worked for me
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.android.support:support-v4:27.1.1"
implementation 'com.android.support:support-v13:27.1.1'
implementation "com.android.support:appcompat-v7:27.1.1"
implementation(project(':react-native-firebase'))
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':react-native-radar')
implementation project(':react-native-google-analytics-bridge')
I need to move the configuration resolution strategies to the android/app/build.gradle file, mine were at the wrong level. I also had to alter versions of the support and appcompat packages. You can find dependencies via
./gradlew app:dependencies
from the android folder. The issue was one of the dependencies was pulling a older version, which was fixed by using the following in the resolutionStrategies.
force 'com.android.support:appcompat-v7:27.1.1'
The next change that needed to be made was the following line in the MainApplication.java
return BuildConfig.DEBUG;
to this
return <app_name>.BuildConfig.DEBUG;
I also removed the enableaapt2=false
The last tip I can give is that naming matters, don't rename your app unless its absolutely necessary and make sure it changes across the Main java files and AndroidMainfest.xml.
UPDATED
I realized my debugger was not connecting, it was because I removed some implementation packages that supported firebase, adding them back fixed the issue. Add the following below the firebase implementation.
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.1"
put this code at the end of android/build.gradle
use your own numbers for the compileSdkVersion and buildToolsVersion
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
}
}
}
}

How to setup/build LibGDX + Kotlin project correctly?

I've downloaded gdx-setup.jar and try to build empty project with the following settings:
And here is what I get in console:
Generating app in C:\Users\Divelix\Desktop\test
Executing 'C:\Users\Divelix\Desktop\test/gradlew.bat clean --no-daemon idea'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.6/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':android'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;
* 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 22s
Done!
To import in Eclipse: File -> Import -> General -> Existing Projects into Workspace
To import to Intellij IDEA: File -> Open -> YourProject.ipr
If I do not mark "Use Kotlin" it builds well, so why is that and what am I doing wrong?
Well, I've finally figured out how to build project correctly with Kotlin (and if you have trouble with gradle it also will help you). Firstly, you just should to build it without "Use Kotlin" and than than edit your project build.gradle file like this:
buildscript {
ext.kotlinVersion = '1.1.1'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
Also you should delete google() if you have it after jcenter()
In :desktop replace java with kotlin plugin and add kotlin-stdlib
project(":desktop") {
apply plugin: "kotlin"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
In :android add kotlin-android plugin and kotlin-stdlib
project(":android") {
apply plugin: "android"
apply plugin: "kotlin-android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
In :core replace java with kotlin plugin and add kotlin-stdlib
project(":core") {
apply plugin: "kotlin"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
If you have just kotlin issue it would be enough.
If you also have gradle issue like me, so open gradle-wrapper.properties and fix gradle version to 3.3:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip