I'm currently testing a game. But when I try to run the app on my device, it gives me this error:
I already tried cleaning the project, but the error stays.
Project:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "RocketHedgehog"
gdxVersion = '1.9.3'
roboVMVersion = '2.1.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
all*.exclude group: 'com.android.support', module: 'support-v4'
}
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.google.android.gms:play-services-ads:9.4.0"
compile "com.google.android.gms:play-services-games:9.6.1"
compile project(':BaseGameUtils')
compile 'com.android.support:multidex:1.0.1'
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
}
}
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"
}
}
tasks.eclipse.doLast {
delete ".project"
}
BaseGameUtils: (Library) I needed this for implementing GPS
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!project.hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!project.hasProperty('gms_library_version')) {
ext.gms_library_version = '8.4.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
ext.android_compile_version = 23
}
if (!project.hasProperty('android_min_version')) {
ext.android_min_version = 9
}
if (!project.hasProperty('android_version')) {
ext.build_tools_version = "23.0.2"
}
compileSdkVersion android_compile_version
buildToolsVersion build_tools_version
defaultConfig {
minSdkVersion android_min_version
targetSdkVersion android_compile_version
}
}
I would recommend you set a variable for the google services and make them all the same version.
For example, your BaseGameUtils uses 8.4.0 consistently, but your project is using various other versions (9.6.1 and 9.4.0)
ext {
appName = "RocketHedgehog"
gms_library_version = "8.4.0" // For consistency with library
Then, update these lines to use that variable.
compile "com.google.android.gms:play-services-ads:${gms_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
Related
I recently connected the Spring messaging module to my libgdx project for graceful use of sockets by following this tutorial: https://nexocode.com/blog/posts/spring-dependencies-in-gradle/
Then the task android: mergeDebugJavaResource swears that I have more than one file META-INF/web-fragment.xml
* What went wrong:
Execution failed for task ':android:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'META-INF/web-fragment.xml'.
Since the problem appears at startup and not build, so I am showing you gradle.build's
build.gradle(app_name)
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.12'
classpath 'com.google.gms:google-services:4.3.5'
}
}
plugins {
id 'java-library'
id 'org.springframework.boot' version '2.1.0.RELEASE'
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "bogatiry-online"
gdxVersion = '1.9.14'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
gdxControllersVersion = '2.1.0'
}
repositories {
mavenLocal()
mavenCentral()
google()
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-tools:$gdxVersion"
}
}
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"
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.box2dlights:box2dlights:$box2DLightsVersion"
}
}
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"
}
}
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
api "com.underwaterapps.overlap2druntime:overlap2d-runtime-libgdx:0.1.0"
api "com.kotcrab.vis:vis-ui:1.3.0"
}
}
build.gradle(:core)
plugins {
id 'org.springframework.boot'
id 'io.spring.dependency-management'
}
sourceCompatibility = 1.7
dependencies {
//Apache
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
//Json
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
//Lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.20'
//Spring
api platform('org.springframework.boot:spring-boot-dependencies:2.1.0.RELEASE')
implementation 'org.springframework.boot:spring-boot-starter-websocket'
dependencies {
constraints {
implementation 'org.springframework.boot:spring-boot-starter-websocket:2.4.5'
}
}
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project.name = appName + "-core"
bootJar {
enabled = false
}
jar {
enabled = true
}
build.gradle(:android) (although I think that the problem is not in it, I did not change it when there was no error)
apply plugin: 'com.google.gms.google-services'
android {
buildToolsVersion "30.0.3"
compileSdkVersion 30
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
packagingOptions {
exclude 'META-INF/robovm/ios/robovm.xml'
}
defaultConfig {
applicationId "com.drownedman.bogatiry"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
}
}
// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives {
doFirst {
file("libs/armeabi/").mkdirs()
file("libs/armeabi-v7a/").mkdirs()
file("libs/arm64-v8a/").mkdirs()
file("libs/x86_64/").mkdirs()
file("libs/x86/").mkdirs()
configurations.natives.copy().files.each { jar ->
def outputDir = null
if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
if(outputDir != null) {
copy {
from zipTree(jar)
into outputDir
include "*.so"
}
}
}
}
}
tasks.whenTaskAdded { packageTask ->
if (packageTask.name.contains("package")) {
packageTask.dependsOn 'copyAndroidNatives'
}
}
task run(type: Exec) {
def path
def localProperties = project.file("../local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream { instr ->
properties.load(instr)
}
def sdkDir = properties.getProperty('sdk.dir')
if (sdkDir) {
path = sdkDir
} else {
path = "$System.env.ANDROID_HOME"
}
} else {
path = "$System.env.ANDROID_HOME"
}
def adb = path + "/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.drownedman.bogatiry/com.drownedman.bogatiry.AndroidLauncher'
}
dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.8.0')
// Declare the dependency for the Firebase Authentication library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-database:19.7.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
}
eclipse.project.name = appName + "-android"
I've tried
File -> Invalidate Caches/Restart.
Checked the compatibility of the versions, everything seems to be ok.
Excluded some "META-INF /" files commonly found in errors like this (More than one file was found with OS independent path 'META-INF/LICENSE'). I can exclude this file the same way, but then I get a similar error with another file, then with another one, and so on.
but it doesn't help
Answering my own question, I just excluded this long list of files, as advised in a similar question More than one file was found with OS independent path 'META-INF/LICENSE'
exclude 'META-INF/web-fragment.xml'
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/NOTICE.md'
exclude 'META-INF/spring.schemas'
exclude 'META-INF/spring.tooling'
exclude 'META-INF/spring.handlers'
exclude 'META-INF/spring-configuration-metadata.json'
exclude 'META-INF/spring.factories'
exclude 'META-INF/additional-spring-configuration-metadata.json'
I'm trying a libgdx project depending on a lib published in local repo with maven-publish:
// to publish locally:
// ~/gdx-gltf$ ./gradlew gltf:publishToMavenLocal
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'io.github.odys-z'
artifactId = 'gdx-gltf'
version = '0.1.0-SNAPSHOT'
from components.java
}
}
}
When I running the depending desktop with gradlew CLI, it's working:
./gradlew desktop:run
But in eclipse and right click the BasicTweenTest class (gradle project.ext.mainClassName) and run as java application, eclipse reported errors:
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Error: Unresolved compilation problems:
sceneAsset cannot be resolved to a variable
GLTFLoader cannot be resolved to a type
SceneModel cannot be resolved to a type
scenes cannot be resolved or is not a field
animationLoader cannot be resolved to a variable
The missing type is in the local repo dependency, gdx-gltf-0.1.0-SNAPSHOT. No matter what I cleaned projects or refreshed gradle, the error persisting appear.
Eclipse Screenshot with stacktrace report
desktop/build.gradle:
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/", "test/" ]
sourceSets.main.resources.srcDirs = ["../android/assets", "test"]
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.DesktopLauncher"
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.PlaneStarTest"
project.ext.mainClassName = "io.oz.wnw.norm.desktop.BasicTweenTest"
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) {
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
dist.dependsOn classes
The other two tests commented out above can run both in CLI and eclipse, which don't depend on the local published package. Any idea?
--------- parent project/build.gradle ----------
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
// jcenter()
google()
}
dependencies {
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.9'
classpath 'com.android.tools.build:gradle:7.0.0-alpha08'
}
}
allprojects {
version = '1.0'
ext {
appName = "wn cloud"
gdxVersion = '1.9.14'
gltfVersion = '0.1.0-SNAPSHOT'
roboVMVersion = '2.3.8'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
mavenCentral()
// jcenter()
google()
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"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
api "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"
}
}
project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"
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.ashley:ashley:$ashleyVersion:sources"
}
}
project(":core") {
apply plugin: "java-library"
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
downloadJavadoc = true
}
}
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api 'io.github.odys-z:gdx-gltf:0.1.0-SNAPSHOT'
}
}
I faced the same problem. Turns out that LibGDX works with JDK 7 and any version compiled above won't work.
You need to enforce java to compile at version 1.7 before publishing locally
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
in my libgdx gradle app I have a class of GroundHandler:
package com.mygdx.physics
import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.physics.box2d.Fixture
import com.badlogic.gdx.physics.box2d.Body
import com.badlogic.gdx.physics.box2d.BodyDef
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.physics.box2d.PolygonShape
import com.badlogic.gdx.physics.box2d.World
class GroundHandler(val world: World, val camera: OrthographicCamera) {
private var groundBodyDef: BodyDef = BodyDef()
private var groundBox: PolygonShape = PolygonShape()
private var groundBody: Body? = null
fun createGround() {
groundBodyDef.position.set(Vector2(0f, 10f))
groundBody = world.createBody(groundBodyDef)
groundBox.setAsBox(camera.viewportWidth, 10.0f)
groundBody?.createFixture(groundBox, 0.0f)
groundBox.dispose()
}
}
which is used in a different class. at first it compiles well, but when app window starts i get
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:133)
Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at com.mygdx.physics.GroundHandler.<init>(GroundHandler.kt)
at com.mygdx.physics.Physics.createGround(Physics.kt:60)
at com.mygdx.physics.Physics.create(Physics.kt:31)
Physics 31 is a line where I call createGround()
UPDATE:
build.gradle as requested (without jar{} part that hasnt worked)
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "physics game"
gdxVersion = '1.9.6'
roboVMVersion = '2.3.1'
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(":core") {
apply plugin: "kotlin"
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.box2dlights:box2dlights:$box2DLightsVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
}
}
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-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"
}
}
tasks.eclipse.doLast {
delete ".project"
}
all i did to this was changing 'java' to 'kotlin' two times and added kotlin dependency to buildscript {}
Just add jar{} section indo desktop.gradle like this:
apply plugin: "kotlin"
sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "com.your.class.name"
project.ext.assetsDir = new File("../android/assets");
jar {
manifest {}
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
everyone! I'm new in android, and I wasted the day, looking for solution. I added Quickblox GCM to my app, and when I tried to to build projects, Gradle says:
Error:(71, 1) A problem occurred evaluating project ':app'.
Could not find method сompile() for arguments [com.quickblox:quickblox-android-sdk-chat:3.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
That is my app/gradle.build:
> buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
//Crashlytics
maven { url 'https://maven.fabric.io/public'
}
//Mockito
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
//Crashlytics
compile ('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
// Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//RxAndroid
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
//Quickblox
сompile "com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion"
сompile "com.quickblox:quickblox-android-sdk-messages:$rootProject.qbSdkVersion"
And this is root gradle.build:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
}
}
ext {
qbSdkVersion = '3.3.0'
}
I did all this, due to instruction on http://quickblox.com/developers/Android#How_to:_add_SDK_to_IDE_and_connect_to_the_cloud
Replace
сompile "com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion"
сompile "com.quickblox:quickblox-android-sdk-messages:$rootProject.qbSdkVersion"
With
compile("com.quickblox:quickblox-android-sdk-chat:2.6.1")
I am trying to configure scala in my libgdx project with the gradle build tool, as written in this article https://github.com/libgdx/libgdx/wiki/Using-libgdx-with-Scala.
I edited allproject and the core gradle files as written in the article. After that i changed my MyGdxGame class from java class to scala class. and after i tried to start the desktop laucher i got the error - Gradle : error : cannot find symbol class MyGdxGame.
How can i solve this issue?
My core gradle file :
apply plugin : "java"
apply plugin : "scala"
sourceCompatibility = 1.6
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.scala.srcDirs = [ "src/" ]
sourceSets.main.java.srcDirs = ["src/"]
eclipse.project {
name = appName + "-core"
}
my allprojects gradle file :
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "scalaTest"
gdxVersion = '1.9.4'
roboVMVersion = '2.2.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(":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"
}
}
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"
}
}
project(":core") {
apply plugin: "java"
apply plugin: "scala"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "org.scala-lang:scala-library:2.11.7"
}
}
tasks.eclipse.doLast {
delete ".project"
}