how to add a library to the dependencies gradle of LIBGDX project - java

All is in the question , I've tried all the answers I found in SO and others sites but with no luck , this is what I've tried so far :
adding compile fileTree(dir: 'lib', include: '*.jar') to my build.gradle
adding compile files('lib/tween-engine-api-sources.jar') to build.gradle
the library I want to add is Tween engine .
build.gradle file :
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = 'my-gdx-game'
gdxVersion = '1.5.4'
roboVMVersion = '1.0.0-SNAPSHOT'
box2DLightsVersion = '1.3'
ashleyVersion = '1.3.1'
aiVersion = '1.5.0'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
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-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile fileTree(dir: 'lib', include: '*.jar')
}
}
tasks.eclipse.doLast {
delete ".project"
}

In the wiki article Dependency management with Gradle, you can find all the information you need. There's even an extra part about the Tween Engine.
Your approach should work, however, you need to update Eclipse via a Right-Click on your projects -> Gradle -> Refresh Dependencies.
For me it worked better though to install the dependencies in my local repository and then reference it from there, instead of referencing the lib folder. This is described here.

Related

ObjectBox DuplicateFileException

We are migrating from ObjectBox 0.9.15 to 1.3.4.
After updating classes (removing #Relation, etc) we added dependency for ObjectBox Browser and get following error that appears on build:
Error:Execution failed for task
':app:transformNativeLibsWithMergeJniLibsForDevelopmentDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK lib/armeabi-v7a/libobjectbox.so
File1:
/Users/gaket/.android/build-cache/40bfb66d64a6d186c399e949921eb119d45150b8/output/jni
File2:
/Users/gaket/.android/build-cache/b30b0ce17a00dfed1ecea8969f4b6fa9a5fe7351/output/jni
Our application consists of two modules: Application type and Library type. ObjectBox plugin and dependencies are used and declared only in Application module. If we change dependency to one without browser, everything works smoothly:
// This works well:
// debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
debugCompile "io.objectbox:objectbox-android:$objectboxVersion"
releaseCompile "io.objectbox:objectbox-android:$objectboxVersion"
Proguard is turned off, multidex enabled.
Do you have any idea what could be the problem?
Applying plugins:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath 'io.objectbox:objectbox-gradle-plugin:1.3.4'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.google.firebase:firebase-plugins:1.1.1'
classpath 'com.google.gms:google-services:3.1.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'io.fabric'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'project-report'
apply plugin: 'io.objectbox'
// There are some oddities when retrolambda isn't the last plugin so try to keep it as the last applied plugin
apply plugin: 'me.tatarka.retrolambda'
// Other configs
// Finally
apply from: 'dependencies.gradle'
apply plugin: 'com.google.gms.google-services'
Dependencies of the Application module:
ext {
butterknifeVersion = '8.8.1'
conductorVersion = '2.1.3'
daggerVersion = '2.11'
exoPlayerVersion = 'r2.5.1'
facebookVersion = '4.24.0'
firebaseVersion = '11.8.0'
glideVersion = '4.0.0'
leakCanaryVersion = '1.5.4'
logbackVersion = '1.1.1-6'
okhttpVersion = '3.8.1'
retrofitVersion = '2.3.0'
supportVersion = '27.0.2'
objectboxVersion = '1.3.4'
dependencies {
compile project(':vyng-core')
// UI Libraries
compile 'com.beloo.widget:ChipsLayoutManager:0.3.7#aar'
compile 'com.muddzdev:styleabletoast:1.0.9'
compile "com.github.jarrodholliday:material-about-library:1.8.4"
compile('com.vdurmont:emoji-java:3.2.0') {
exclude group: 'org.json', module: 'json'
}
compile('eu.davidea:flexible-adapter:5.0.0-rc2') {
exclude group: 'com.android.support', module: 'design'
}
//noinspection GradleCompatible
compile "com.android.support.constraint:constraint-layout:1.1.0-beta4"
// Rx Libraries
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4#aar'
compile 'oxim.digital:rx2anim:0.9.1'
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
// Fabric Libraries
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true
}
//DB libraries
debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
releaseCompile "io.objectbox:objectbox-android:$objectboxVersion"
// Logger
compile 'com.jakewharton.timber:timber:4.6.0'
compile 'org.slf4j:slf4j-api:1.7.25'
compile "com.github.tony19:logback-android-core:$logbackVersion"
compile "com.github.tony19:logback-android-classic:$logbackVersion"
// Util Libraries
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.googlecode.libphonenumber:libphonenumber:8.8.1'
compile "com.facebook.android:facebook-android-sdk:$facebookVersion"
compile 'com.writingminds:FFmpegAndroid:0.3.2'
compile 'com.google.guava:guava:23.0-android'
// Image Libraries
compile "com.github.bumptech.glide:glide:$glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
compile "jp.wasabeef:glide-transformations:3.0.1"
//compile 'jp.wasabeef:blurry:2.1.1'
// Support Libraries
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
// Firebase Libraries
compile "com.google.firebase:firebase-core:$firebaseVersion"
compile "com.google.firebase:firebase-auth:$firebaseVersion"
compile "com.google.firebase:firebase-messaging:$firebaseVersion"
compile "com.google.firebase:firebase-invites:$firebaseVersion"
// Conductor Libraries
compile "com.bluelinelabs:conductor:2.1.4"
// Dependency Injection
compile "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
provided "javax.annotation:jsr250-api:1.0"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
//auth
compile "com.facebook.android:account-kit-sdk:$facebookVersion"
// Video Libraries
compile "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
compile "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
compile "com.google.android.exoplayer:exoplayer-dash:$exoPlayerVersion"
compile "com.yqritc:android-scalablevideoview:1.0.4"
compile('com.github.jarrodholliday:videocache:2.7.1') {
exclude module: 'slf4j-android'
exclude group: 'com.google.android', module: 'android'
}
// Networking Libraries
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
compile "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
compile "com.squareup.okhttp3:okhttp:$okhttpVersion"
// Debug/Testing
debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:2.10.0"
androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.0') {
exclude module: 'support-annotations'
exclude group: 'com.google.code.findbugs'
}
}
}
I decided to leave previous common answer because it can help other people with other libraries.
Specifically for ObjectBox, the reason is that we should put dependencies before applying the plugin, I missed this point in documentation (in "Setup" block):
// ObjectBox browser dependencies must be set before applying ObjectBox plugin so it does not add objectbox-android
// (would result in two conflicting versions, e.g. "Duplicate files copied in APK lib/armeabi-v7a/libobjectbox.so").
dependencies {
debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
releaseCompile "io.objectbox:objectbox-android:$objectboxVersion"
}
Adding packagingOptions (details are in docs) inside android part of gradle.build helped. However, if someone knows cleaner and not so shallow solution, I will be glad to see it.
android {
// some stuff
packagingOptions {
pickFirst 'lib/armeabi-v7a/libobjectbox.so'
pickFirst 'lib/arm64-v8a/libobjectbox.so'
pickFirst 'lib/x86_64/libobjectbox.so'
pickFirst 'lib/x86/libobjectbox.so'
}
}

Failed to resolve: com.android.support:support-fragment:26.1.0 [duplicate]

This question already has answers here:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
Mark my question by This Question Link but the question is not similar to this question.The reason is - "com.android.support:support-fragment:26.1.0" dependency not added to my project. The question has different reason and different error. Also the answer of Question Link is not work for this problem.
I am using Android Studio 2.3.3 and Android Studio 3.0 BETA 6 side by side in my pc. In my project I get the error as below image -
I am using dependencies-
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.karumi:dexter:4.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.jakewharton:butterknife:8.7.0'
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
}
apply plugin: 'com.google.gms.google-services'
and use -
compileSdkVersion 26
buildToolsVersion "26.0.0"
in the gradle file I use this code -
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.firebase:firebase-plugins:1.0.4'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am stuck to find this problem solution.
You have to add maven { url 'https://maven.google.com' } in repositories section.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}

Android Studio - No Option to add dependencies?

I want to add GooglePlayServices to an already existing project (Libgdx). But i have an problem, after i added them to the build.gradle file, they dont show up. I already installed GooglePlayServices using the SDK manager. What did i do wrong ..?
When i go to Project Structure under the dependencies tab, there only 3 different options :
Add Jar or Folder ( selfexplained )
Add Library
Add Module Dependencies ( When i click this, im able to add my Main or Core Module as an Dependencies. No other options )
Heres an picture of my Project Tree:
Heres an picture of my Project Structure :
The only Dependencie i can import is the Module one... Thats strange.
And heres what my whole build.gradle ( I post all because i have totally no idea wheres the error part ) i marked the lines, which i added for GooglePlayService :
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "ParallelOrigin"
gdxVersion = '1.9.5'
roboVMVersion = '2.3.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":android") {
apply plugin: "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.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
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"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
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 "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
compile "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.2.0"
//----------------------------------------------------------------------------//
//--------------------------Added by myself-----------------------------------//
//----------------------------------------------------------------------------//
compile "com.android.support:support-core-utils:23.2.1"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
compile "com.underwaterapps.overlap2druntime:overlap2d-runtime-libgdx:0.1.0"
compile "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:0.13.4"
compile "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.2.0"
//----------------------------------------------------------------------------//
//--------------------------Added by myself-----------------------------------//
//----------------------------------------------------------------------------//
compile "com.android.support:support-core-utils:23.2.1"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
}
}
tasks.eclipse.doLast {
delete ".project"
}
Thanks for your help and your time !
I found the iusse !
This only happened because my project wasnt a gradle one. I only needed to migrate it and then i could import those maven dependencies !

libgdx utils HTML

I try to GWT compile my libgdx project which using libgdx utils from http://dermetfan.net/
I have very similiar question to Can't Run html libgdx with libgdx-utils
but nothing helps me...
I have done everything step by step, editing my
build.gradle
(https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions)
Now it look like:
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = 'TEST'
gdxVersion = '1.6.2'
roboVMVersion = '1.3.0'
box2DLightsVersion = '1.3'
ashleyVersion = '1.4.0'
aiVersion = '1.5.0'
gdxUtilsVersion = '0.11.0'
gdxUtilssVersion = '0.13.1'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilssVersion"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilssVersion"
}
}
project(":desktop") {
apply plugin: "java"
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-box2d-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "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-x86"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
}
}
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources"
}
}
tasks.eclipse.doLast {
delete ".project"
}
And Error:
Compiling module com.adacho.test.GdxDefinition
Validating units:
[ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Ground.java'
[ERROR] Line 21: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
[ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/MovingPlatform.java'
[ERROR] Line 26: No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite; did you forget to inherit a required module?
[ERROR] Errors in 'file:/C:/ADACHO/LibGDX%20-%20Projekty/PROJEKTY/TEST/core/src/com/adacho/test/obiekty/Postac.java'
[ERROR] Line 47: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedBox2DSprite; did you forget to inherit a required module?
[ERROR] Line 88: No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite; did you forget to inherit a required module?
[ERROR] Aborting compile due to errors in some input files
What surprises me is when i clear my build.gradle nothing change? WHere is problem? Please help me, i spent few days with this problem...
The GWT compiler says:
No source code is available for type net.dermetfan.gdx.graphics.g2d.AnimatedSprite
No source code is available for type net.dermetfan.gdx.graphics.g2d.Box2DSprite
AnimatedSprite resides in libgdx-utils.
Box2DSprite resides in libgdx-utils-box2d.
Apparently GWT is missing these libraries' sources so you need to add them to the HTML project's dependencies.
Your HTML project's dependencies should now look like this:
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion:sources" // Box2D module (sources)
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d-gwt:$gdxUtilsVersion:sources" // Box2D module GWT specific classes (sources)
libgdx-utils-box2d-gwt only contains GWT specific classes and does not include everything from libgdx-utils-box2d. In fact I hope to remove libgdx-utils-box2d-gwt completely some time in the future.
It seems the example build script on the wiki had the same problem, sorry for that.

new libgdx setup build keeps failing

I downloaded the new libgdx-setup and every time I generate a project with box2dlights it fails and I can't import it because it keeps giving me an error about not finding box2dlights. I also had an issue with the older gdx-setup-ui where I couldn't access third party libraries so I am getting frustrated with libgdx.
* What went wrong:
A problem occurred configuring project ':android'.
> Could not resolve all dependencies for configuration ':android:_debugCompile'.
> Could not find com.badlogicgames.box2dlights:box2dlights:1.2.
Required by:
test:android:1.0
test:android:1.0 > test:core:1.0
When I generate a project with no dependencies checked I can import it fine into eclipse, but I want to be able to select box2dlights as I am going to be using it. I can see box2dlights in my build.gradle so from what I have gathered, it should automatically download. Here is my build.gradle
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9+'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = 'my-gdx-game'
gdxVersion = '1.0.0'
roboVMVersion = '0.0.11'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
project(":desktop") {
apply plugin: "java"
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-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
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-x86"
compile "com.badlogicgames.box2dlights:box2dlights:1.1"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
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-x86"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:1.2"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
I can see compile "com.badlogicgames.box2dlights:box2dlights:1.1", which according to the github docs is all I need, plus I didn't change any settings so everything by default should work shouldn't it?
I believe the 1.2 is a typo.. I'm not aware of box2D lights have a version 1.2 as of yet, unless it's coming and they pre-emptively had it put in ahead of schedule to be called instead of v1.1.
For my eclipse build, I was able to compile it after changing all references of 1.2 to 1.1, and my gradle built just fine.
The setup worked even though I got those errors when using the gdx ui provided for the gradle build.
(at the very bottom of your gradle file, I noticed in the :core area, you still have a reference to boxlights 1.2, which you should change to 1.1)

Categories