Android Studio 3.4 and gradle-5.1.1

Anything libgdx related goes here!

Android Studio 3.4 and gradle-5.1.1

Postby vijaydino » Sun May 05, 2019 7:08 am

Hi,
I ' m using an updated version of the Android Studio that is Android Studio 3.4 and libgdx gradle is not working anymore, because the minimum version of gradle is now 5.1.1 There are several changes
So. i am getting error in desktop module gradle file

Now here is my code of file build.gradle( Module: Desktop)

apply plugin: "java"

sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]

project.ext.mainClassName = "com.dinocodeacademy.blogspot.myfirstgame.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets");

task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}

task debug(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}

task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);

manifest {
attributes 'Main-Class': project.mainClassName
}
}

dist.dependsOn classes

eclipse {
project {
name = appName + "-desktop"
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
}
}

task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
doLast {
def classpath = new XmlParser().parse(file(".classpath"))
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
def writer = new FileWriter(file(".classpath"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)
printer.print(classpath)
}
}

------------------------End of the code ----------------------------------------

I 'm getting error on task afterEclipseImport{ } on new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
and also when i try to import the class by Pressing Atl+Enter the error is still because there are lots of classes will pop-pup and i don't know which one is correct

Here is error msg: when the build is failed


ERROR: Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
Open File



Any help will be appricated
vijaydino
 
Posts: 1
Joined: Sun May 05, 2019 6:43 am

Re: Android Studio 3.4 and gradle-5.1.1

Postby vik182 » Sun May 05, 2019 3:26 pm

vik182
 
Posts: 40
Joined: Wed Jul 04, 2018 9:44 pm

Re: Android Studio 3.4 and gradle-5.1.1

Postby shatterblast » Sun May 05, 2019 7:21 pm

vijaydino wrote:
Here is error msg: when the build is failed


ERROR: Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

Add an 's' to the end of 'classesDir' so that it becomes 'classesDirs'. I made the same mistake.
shatterblast
 
Posts: 306
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest