When I create a new project in Android Studio(java). This Error comes out, How to solve?
build.gradle:
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error:
Build file 'C:\Users\sambit.pradhan\AndroidStudioProjects\MyApplication\build.gradle' line: 3
Plugin [id: 'com.android.application', version: '7.2.1', apply: false] was not found in any of the following sources:
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '7.2.1', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:7.2.1')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
MavenRepo
Screenshot
everytime that I try to use LibGDX and netbeans I am struggling to just to get started.
create class
class created
I am not sure if the photos are going to be visible since I just created my account and my reputation is low but let me explain myself in case they will not.
So I created another project using LibGDX this is the result I got:
Executing 'C:\.....\ProTest/gradlew.bat clean --no-daemon' To honour
> the JVM settings for this build a new JVM will be forked. Please
> consider using the daemon:
> https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html. Daemon
> will be stopped at the end of the build stopping after processing
> > Task :android:clean UP-TO-DATE
> > Task :core:clean UP-TO-DATE
> > Task :desktop:clean UP-TO-DATE
> > Task :html:clean
> > Task :ios:clean UP-TO-DATE Warning: Failed to parse host SSTap Warning: Failed to parse host SSTap 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.7.1/userguide/command_line_interface.html#sec:command_line_warnings
> BUILD SUCCESSFUL in 21s 5 actionable tasks: 1 executed, 4 up-to-date
> Done! To import in Eclipse: File -> Import -> Gradle -> Existing
> Gradle Project To import to Intellij IDEA: File -> Open ->
> build.gradle To import to NetBeans: File -> Open Project...
After that I opened Netbeans and Opened the project, trustgradle execution...
And I opened core, desktop and IOs without any problem from the subprojects created.
I went to the desktop project and inside has a class called "DesktopLauncher"
the code inside is
> package com.supa.testa.desktop; import
> com.badlogic.gdx.backends.lwjgl.LwjglApplication; import
> com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; public
> class DesktopLauncher { public static void main (String[] arg) {
> LwjglApplicationConfiguration config = new
> LwjglApplicationConfiguration(); new LwjglApplication(new Testo (),
> config); } }
and I created a class in the path "com.supa.testa" but it was created without mentioned the package on the top, I thought that by using extends Game will be fixed somehow as I cannot find the error and even write down the package path by myself... the code for the class "Testo" now looks like this:
package com.supa.testa;
import com.badlogic.gdx.Game;
public class Testo extends Game{
#Override
public void create() {
}
}
So I cameb back to the DesktopLauncher class and tried to create a class by using the "bulb" I dont know the name (help me with that please) and another class with the same name "Testo" was created in another path but again without the package on the top and it implemented the ApplicaitonListener by itself
import com.badlogic.gdx.ApplicationListener;
public class Testo implements ApplicationListener {
public Testo() {
}
}
then I came back to DesktopLauncher did the same and I could be doing that over and over again
it will go as "Testo_1" "Testo_2" and the class will never have a package and it will never be recognized
I tried to build and clean the project from the desktop, the core, the project itself, clean, build separately
Open and closed netbeans
create different projects (this was the last one)
The last thing I have tried, I pressed "Ctrl + Space bar" after the code:
new LwjglApplication(new .....
and the classes that appear are from other projects
When I created a project with LibGDX I am having this issue randomly
But now I can't get rid of it haha
I am not sure if its related with the Daemon
And in another of the tests I did the "LwjglApplicationConfiguration" library from badlogicgames seems like did not loaded because I was unable to use, did not appear at all, even after writing it manually it will not work (same as for the packages :( )
Have a nice day :D
Reedit:
I tried to create another project the previous was using Desktop, Android, IOs and Html
I tried only with desktop and the packages are working properly
I tried with Desktop and Html and this is what I got
Generating app in C:......
Executing 'C:\........ setup\ProTestD__H/gradlew.bat clean --no-daemon'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'ProTestD__H'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download commons-logging-1.1.1.jar (commons-logging:commons-logging:1.1.1)
> Could not get resource 'https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> Could not HEAD 'https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> SSTap
* 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 13s
Done!
To import in Eclipse: File -> Import -> Gradle -> Existing Gradle Project
To import to Intellij IDEA: File -> Open -> build.gradle
To import to NetBeans: File -> Open Project...
After that I opened the project to try to:
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.
In the Run gradle "--stacktrace":
enter image description here
enter image description here
enter image description here
enter image description here
and the code still going Im not sure if the photos will be uploaded and it is a lot so I cannot copy paste it here, I will try to past what I think is important
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'ProTestD__H'.
Could not resolve all artifacts for configuration ':classpath'.
Could not download commons-logging-1.1.1.jar (commons-logging:commons-logging:1.1.1)
> Could not get resource 'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> Could not HEAD 'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> SSTap
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'ProTestD__H'. at
org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
Caused by:
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:
Could not resolve all artifacts for configuration ':classpath'.
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could
not download commons-logging-1.1.1.jar
(commons-logging:commons-logging:1.1.1)
Caused by: org.gradle.api.resources.ResourceException: Could not get
resource
'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
Caused by:
org.gradle.internal.resource.transport.http.HttpRequestException:
Could not HEAD
'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
Caused by: java.net.UnknownHostException: SSTap
Using "--info" got:
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'ProTestD__H'.
Could not resolve all artifacts for configuration ':classpath'.
Could not download commons-logging-1.1.1.jar (commons-logging:commons-logging:1.1.1)
> Could not get resource 'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> Could not HEAD 'ttps://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
> SSTap
Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
Using "--scan" got this:
.\gradlew.bat --configure-on-demand -w --scan -x check
FAILURE: Build failed with an exception.
Where: Auto-applied by using --scan
What went wrong: Plugin [id: 'com.gradle.enterprise', version: '3.4.1', artifact: 'com.gradle:gradle-enterprise-gradle-plugin:3.4.1']
was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'com.gradle:gradle-enterprise-gradle-plugin:3.4.1') Searched in the
following repositories:
Gradle Central Plugin Repository
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 ttps://help.gradle.org
BUILD FAILED in 2s
And i got this when trying to resolve and trust the project
SSTap<br/>Could not HEAD 'https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.<br/>Could not get resource 'https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.<br/>Could not download commons-logging-1.1.1.jar (commons-logging:commons-logging:1.1.1)<br/>Could not resolve all artifacts for configuration ':classpath'.<br/>A problem occurred configuring root project 'ProTestD__H'.<br/>A problem occurred configuring root project 'ProTestD__H'.<br/>Could not run build action using connection to Gradle installation 'C:\......\.gradle\wrapper\dists\gradle-6.7.1-bin\bwlcbys1h7rz3272sye1xwiv6\gradle-6.7.1'.
I also tried to follow the tutorials in LibGDX tutorials LibGDX tutorials
When trying to run the project in android by using the desktop folder
I got the "Warning: Class 'com.my.game.desktop.DesktopLauncher' not found in module 'Test'" I applied, tried to run and got:
Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-6.7.1-bin.zip'.
This is my build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
classpath 'org.gretty:gretty:3.0.2'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.12'
} }
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "Kiya"
gdxVersion = '1.10.0'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
gdxControllersVersion = '2.1.0'
}
repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
} }
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
} }
project(":android") {
apply plugin: "com.android.application"
configurations { natives }
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
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"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
} }
project(":ios") {
apply plugin: "java-library"
apply plugin: "robovm"
dependencies {
implementation project(":core")
api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
} }
project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"
apply plugin: "org.gretty"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
} }
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
} }
Not sure if I understood the question correctly, but if your problem is, that the DesctopLauncher doesn't know the class Testo you just need to import it: import com.supa.testa.Testo
Also you should place your Game classes (and packages) like Testo in the core project, since it will be used in all projects (desctop and ios).
You should have a look at the libGDX tutorials.
Especially Setup and Hello World should contain what you are searching for.
I have this other post... Removing the proxy and host from Netbeans I just fixed it.... and even tho the packages are stillnot visible in core or desktop project, if I create a class in core and put some code in it and run it from Desktoplauncher it works even tho it shows an error cannot find symbol(class), but the projects runs perfectly... for now O_O
The classes are still created without package and if the package is created(typed) by myself it shows error but now it works. Even if it is a project that uses ScreenAdapter
This is what I did....
I went into my gradle.properties file found in C:\Users\User. gradle inside looks like this:
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Dec 25 18:51:22 CST 2021
systemProp.http.proxyHost=SSTap
systemProp.https.proxyHost=SSTap
systemProp.https.proxyPort=25378
systemProp.http.proxyPort=25378
systemProp.https.nonProxyHosts=127.0.0.1
systemProp.http.nonProxyHosts=127.0.0.1
I removed the last 6 rows,created a new project using Desktop, Android, IOs, HTML in LibGDX , trusted all the projects with gradle, classes have no packages when created, if I create them or import them by myself (in desktop project). And even if it says "cannot find symbol"(class) within the core path e.g. import com.pokedemon.game.Hello; the code runs
I'm trying to find out the line coverage of the JUnit tests in my java program by using gradle and jacoco but the following command causes a failure.
gradle test jacoocoTestReport
The command prints:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'jacoocoTestReport' not found in root project 'ProjectName'. Some candidates are: 'jacocoTestReport'.
* Try:
Run gradle tasks to get a list of available tasks. Run with
--stacktrace option to get the stack trace. Run with
--info
or
--debug
option to get more log output.
BUILD FAILED
Total time: 3.389 secs
The build.gradle of my gradle project:
apply plugin: "jacoco"
apply plugin: 'java'
apply plugin: 'application'
repositories {
jcenter()
}
dependencies {
compile 'com.google.guava:guava:20.0'
testCompile 'junit:junit:4.12'
}
mainClassName = 'example.Main'
run {
standardInput = System.in
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
You have a typo: use
jacocoTestReport
instead of
jacoocoTestReport
(two o's).
Use
gradle tasks
to check what tasks are defined.
You've run an invalid task (double o):
gradle test jacoocoTestReport
instead of:
gradle test jacocoTestReport
I'm trying run gradle task. Before running one task I want to see all available tasks gradle tasks. To do it I go to the directory of my project, where is file build.gradle. When I have executed command I got an error
could not find property 'sourceSets' on root project gradle
Plugins that are applied to build.gradle should be at the very beginning of the build.gradle script. Move:
apply plugin: 'java'
apply plugin: 'findbugs'
to the beginning of the script.
I have the following build.gradle file:
apply plugin: 'java'
repositories {
mavenCentral()
}
repositories {
maven { url "http://oss.sonatype.org/content/repositories/snapshots" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
compile 'com.skadistats:clarity:1.2',
'joda-time:joda-time:2.6',
'com.google.code.gson:gson:2.3.1'
}
And when I try to do a compileJava I have the following error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/tim/Workspace/thedotabot/replay_parser/build.gradle' line: 11
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find com.skadistats:clarity-protobuf:LATEST.
Searched in the following locations:
https://repo1.maven.org/maven2/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.pom
https://repo1.maven.org/maven2/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.jar
http://oss.sonatype.org/content/repositories/snapshots/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.pom
http://oss.sonatype.org/content/repositories/snapshots/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.jar
http://repo.maven.apache.org/maven2/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.pom
http://repo.maven.apache.org/maven2/com/skadistats/clarity-protobuf/LATEST/clarity-protobuf-LATEST.jar
Required by:
:replay_parser:1.0 > com.skadistats:clarity:1.2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
If I checkout the original project from the repository on Github, switch to the V1 branch and do a mvn install it works fine.
My understanding of the problem is that clarity has this dependency:
<dependency>
<groupId>com.skadistats</groupId>
<artifactId>clarity-protobuf</artifactId>
<version>LATEST</version>
</dependency>
And Gradle fails to find it as the version is LATEST.
How can I solve this ?
LATEST is maven keyword which it is possible that Gradle does not support very well. As a workaround can you try to add an explicit dependency on clarity-protobuf and use latest.integration as the version.