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'
Related
So I am having android app using libgdx and tried to implement google play services. When I turn on an emulator, it's just appears black screen. Go to Android Monitor and this shows up:
09-22 11:56:48.140 1571-1571/? E/MobileDataStateTracker: default: Ignoring feature request because could not acquire PhoneService
09-22 11:56:48.140 1571-1571/? E/MobileDataStateTracker: default: Could not enable APN type "default"
09-22 11:56:56.777 1861-1975/? E/ActivityThread: Failed to find provider info for com.google.android.wearable.settings
09-22 11:56:59.757 1861-1975/? E/ActivityThread: Failed to find provider info for com.google.android.wearable.settings
09-22 11:57:01.687 2159-2174/? E/ActivityThread: Failed to find provider info for com.google.android.partnersetup.rlzappprovider
09-22 11:57:03.467 1861-2219/? E/ActivityThread: Failed to find provider info for com.google.android.wearable.settings
09-22 11:57:06.017 1861-2219/? E/ActivityThread: Failed to find provider info for com.google.android.wearable.settings
09-22 11:57:34.537 1861-1861/? E/ActivityThread: Service com.google.android.gms.chimera.GmsIntentOperationService has leaked ServiceConnection crs#a53b5ea8 that was originally bound here
android.app.ServiceConnectionLeaked: Service com.google.android.gms.chimera.GmsIntentOperationService has leaked ServiceConnection crs#a53b5ea8 that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1561)
at android.app.ContextImpl.bindService(ContextImpl.java:1544)
at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
at com.google.android.gms.chimera.container.zapp.ZappLogOperation.onHandleIntent(:com.google.android.gms#11509030:1)
at com.google.android.chimera.IntentOperation.onHandleIntent(:com.google.android.gms#11509030:2)
at bvr.run(:com.google.android.gms#11509030:10)
at bvo.run(:com.google.android.gms#11509030:14)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
09-22 12:13:57.597 2765-2765/? E/memtrack: Couldn't load memtrack module (No such file or directory)
09-22 12:13:57.597 2765-2765/? E/android.os.Debug: failed to load memtrack module: -2
09-22 12:13:57.617 1571-1600/? E/InputDispatcher: channel 'a534dd00 com.squareit.pupindev/com.squareit.pupindev.AndroidLauncher (server)' ~ Channel is unrecoverably broken and will be disposed!
I thought that it was from implementing Play Services and Google Ads but I removed all dependencies and code from gradle files and Android Launcher, so my gradle files look like this:
Project:
buildscript {
repositories {
mavenLocal()
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:2.3.3'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "SquareIt"
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/" }
maven {
url "https://maven.google.com"
}
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
// compile project(":BaseGameUtils")
compile 'com.android.support:multidex:1.0.1'
compile "com.android.support:appcompat-v7:25.3.1"
compile "com.android.support:support-v4:25.3.1"
compile 'com.android.support:support-annotations:25.3.1'
// compile 'com.google.android.gms:play-services-ads:11.2.2'
// compile 'com.google.android.gms:play-services-games:11.2.2'
// compile 'com.google.android.gms:play-services-drive:11.2.2'
// compile 'com.google.android.gms:play-services-auth:11.2.2'
// compile "com.google.android.gms:play-services-plus:11.2.2"
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-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"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
Android module:
android {
buildToolsVersion "26.0.1"
compileSdkVersion 26
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
instrumentTest.setRoot('tests')
}
packagingOptions {
exclude 'META-INF/robovm/ios/robovm.xml'
}
defaultConfig {
applicationId "com.squareit.pupindev"
minSdkVersion 14
targetSdkVersion 26
versionCode 4
versionName "1.1.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations {
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
// 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() {
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.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"
}
}
}
}
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.mygdx.game/com.mygdx.game.AndroidLauncher'
}
// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
// need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
// ignores any nodes added in classpath.file.withXml
sourceSets {
main {
java.srcDirs "src", 'gen'
}
}
jdt {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
classpath {
plusConfigurations += [project.configurations.compile]
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
}
project {
name = appName + "-android"
natures 'com.android.ide.eclipse.adt.AndroidNature'
buildCommands.clear();
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
buildCommand "org.eclipse.jdt.core.javabuilder"
buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
}
}
// sets up the Android Idea project, using the old Ant based build.
idea {
module {
sourceDirs += file("src");
scopes = [COMPILE: [plus: [project.configurations.compile]]]
iml {
withXml {
def node = it.asNode()
def builder = NodeBuilder.newInstance();
builder.current = node;
builder.component(name: "FacetManager") {
facet(type: "android", name: "Android") {
configuration {
option(name: "UPDATE_PROPERTY_FILES", value: "true")
}
}
}
}
}
}
}
dependencies {
}
Here is AndroidLauncher extends AndroidApplication onCreate method:
#Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(mainGame = new Squareit(this), config);
}
Help please!
I've been trying to figure this out for 2 days and tried almost everything I could find, but with no luck.
The app builds ok, but then when I Make Project I get this error.
Running Android Studio 2.3 , jdk 1.8 on Windows 10 64-bit
Already tried using Jack and guava version 20.0
This is my gradle.build:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// Realm
classpath "io.realm:realm-gradle-plugin:3.0.0"
//GCM
classpath 'com.google.gms:google-services:3.0.0'
// Retrolambda , https://github.com/evant/gradle-retrolambda/
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
// https://github.com/JakeWharton/butterknife
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and gradle.build in the app dir:
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def generateFireBaseJsonConfiguration(file) {
def properties = loadPropertiesFile(file)
def templateFile = new File("google-services.json.template")
def json = new JsonSlurper().parseText(templateFile.text)
// populate properties
json.project_info.project_number = properties['FirebaseProjectInfoNumber']
json.project_info.firebase_url = properties['FirebaseProjectInfoUrl']
json.project_info.project_id = properties['FirebaseProjectInfoId']
json.project_info.storage_bucket = properties['FirebaseProjectInfoBucket']
json.client[0].client_info.mobilesdk_app_id = properties['FirebaseClientInfoMobileSDKAppId']
json.client[0].client_info.android_client_info.package_name = "org.openstack.android.summit"
json.client[0].api_key[0].current_key = properties['FirebaseClientApiKeyCurrent']
json.client[0].oauth_client[0].client_id = properties['FirebaseClientOAUTH2ClientClientId1']
json.client[0].oauth_client[0].client_type = 3
json.client[0].oauth_client[1].client_id = properties['FirebaseClientOAUTH2ClientClientId2']
json.client[0].oauth_client[1].client_type = 3
def jsonFile = new File("app/google-services.json")
jsonFile.write(JsonOutput.toJson(json))
}
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
flatDir {
dirs 'libs'
}
}
def loadPropertiesFile(properties_file){
Properties props = new Properties()
println 'loading properties file : '+ properties_file;
props.load(new FileInputStream(file(properties_file)));
return props;
}
def getPropertyFromFile(properties_file, key){
Properties props = loadPropertiesFile(properties_file);
return props[key]
}
def expandManifest(flavor, properties_file) {
println 'expanding manifest for: ' + flavor
Properties props = loadPropertiesFile(properties_file);
return [
googleMapApiKey: props['googleMapApiKey'],
fabricApiKey: props['fabricApiKey'],
parseApplicationId: props['parseApplicationId'],
parseClientKey: props['parseClientKey'],
ServiceClientId: props['ServiceClientId'],
ServiceClientSecret: props['ServiceClientSecret'],
NativeClientId: props['NativeClientId'],
NativeClientSecret: props['NativeClientSecret'],
NativeClientReturnUrl: props['NativeClientReturnUrl'],
ResourceServerBaseUrl: props['ResourceServerBaseUrl'],
IdentityProviderBaseUrl: props['IdentityProviderBaseUrl'],
WebSiteBaseUrl: props['WebSiteBaseUrl'],
YouTubeAndroidPlayerAPIKey: props['YouTubeAndroidPlayerAPIKey'],
BasicAuthUser: props['BasicAuthUser'],
BasicAuthPass: props['BasicAuthPass'],
]
}
android {
signingConfigs {
config {
}
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "org.openstack.android.summit"
minSdkVersion 16
targetSdkVersion 25
versionCode 72
versionName "2.0"
multiDexEnabled true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
debug {
// Settings for Crashlytics Beta Distribution
ext.betaDistributionReleaseNotes = "Release Notes for this build."
ext.betaDistributionEmails = getPropertyFromFile("../summit-app.debug.properties", "BetaDistributionEmails")
ext.enableCrashlytics = false
}
release {
minifyEnabled true
//debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
development {
generateFireBaseJsonConfiguration("../summit-app.debug.properties")
ext.betaDistributionEmails = getPropertyFromFile("../summit-app.debug.properties", "BetaDistributionEmails")
manifestPlaceholders = expandManifest("beta", "../summit-app.debug.properties")
}
production {
generateFireBaseJsonConfiguration("../summit-app.properties")
manifestPlaceholders = expandManifest("production", "../summit-app.properties")
}
beta {
generateFireBaseJsonConfiguration("../summit-app.debug.properties")
manifestPlaceholders = expandManifest("beta", "../summit-app.debug.properties")
}
}
packagingOptions {
pickFirst 'META-INF/license.txt'
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/NOTICE.txt'
// to avoid error file included twice
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("development") && variant.buildType.name == "release") {
variant.ignore = true
}
if (names.contains("production") && variant.buildType.name == "debug") {
variant.ignore = true
}
if (names.contains("beta") && variant.buildType.name == "debug") {
variant.ignore = true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'jp.wasabeef:recyclerview-animators:2.2.5'
compile 'com.android.support:design:25.2.0'
compile 'joda-time:joda-time:2.9.4'
compile 'com.google.code.gson:gson:2.7'
// Dagger 2 and Compiler
// https://github.com/google/dagger
compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
// Google's OAuth library for OpenID Connect
// See https://code.google.com/p/google-oauth-java-client/wiki/Setup
compile('com.google.oauth-client:google-oauth-client:1.22.0') {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'junit', module: 'junit'
exclude group: 'com.google.android', module: 'android'
}
compile 'com.google.api-client:google-api-client-android:1.21.0'
// Google's JSON parsing, could be replaced with Jackson
compile 'com.google.api-client:google-api-client-gson:1.21.0'
compile 'org.modelmapper:modelmapper:0.7.5'
compile('com.github.claudioredi:Ranger:da908aa') {
exclude module: 'joda-time'
}
// progress indicator
compile 'cc.cloudist.acplibrary:library:1.2.1'
// pop up alerts
compile 'com.github.claudioredi:sweet-alert-dialog:9c1be1a'
// image library
compile 'com.facebook.fresco:fresco:0.11.0'
// simulate list with a linear layout
compile 'com.github.frankiesardo:linearlistview:1.0.1#aar'
// page indicator
compile 'com.githang:viewpagerindicator:2.4.2#aar'
// Tags
compile 'com.github.kaedea:Android-Cloud-TagView-Plus:5a49f4f'
// google maps
compile 'com.google.android.gms:play-services-maps:10.0.1'
// to get rid of UNEXPECTED TOP-LEVEL EXCEPTION: due oo many method references: (max is 65536)
// https://github.com/BoltsFramework/Bolts-Android
compile 'com.android.support:multidex:1.0.1'
compile 'com.parse.bolts:bolts-applinks:1.4.0'
compile files('libs/YouTubeAndroidPlayerApi.jar')
// material design spiner
compile('com.weiwangcn.betterspinner:library-material:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true;
}
testCompile 'org.mockito:mockito-core:2.0.86-beta'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.1'
testCompile 'org.powermock:powermock-module-junit4:1.6.5'
testCompile 'org.powermock:powermock-module-junit4-rule:1.6.5'
testCompile 'org.powermock:powermock-api-mockito:1.6.5'
testCompile 'org.powermock:powermock-classloading-xstream:1.6.5'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
if (file('libs/safe_storage.aar').exists()) {
println('adding dependency safe_storage.aar ...')
productionCompile "org.openstack.android.summit.safestorage:safe_storage#aar"
}
if (file('libs/safe_storage-testing.aar').exists()) {
println('adding dependency safe_storage-testing.aar ...')
betaCompile "org.openstack.android.summit.safestorage:safe_storage-testing#aar"
}
if (file('libs/safe_storage_debug.aar').exists()) {
println('adding dependency safe_storage_debug.aar ...')
developmentCompile "org.openstack.android.summit.safestorage:safe_storage_debug#aar"
}
// http://facebook.github.io/stetho and https://github.com/uPhyca/stetho-realm
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.uphyca:stetho_realm:2.0.0'
// retrofit (REST API)
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.5.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
// Espresso Dependencies
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude module: 'support-annotations'
exclude module: 'support-v4'
exclude module: 'recyclerview-v7'
exclude module: 'design'
})
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.0.1'
}
}
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
// RXJAVA
// HACK to get rid of an error related to realm https://github.com/realm/realm-java/issues/1963
// this is needed bc REALM dependency
compile('io.reactivex:rxjava:1.1.7') {
exclude module: 'rx.internal.operators'
}
// RXJAVA 2.x
compile 'io.reactivex.rxjava2:rxjava:2.0.5'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.jakewharton.butterknife'
Finally this is the console log:
...
:app:incrementalDevelopmentDebugJavaCompilationSafeguard
:app:javaPreCompileDevelopmentDebug
:app:compileDevelopmentDebugJavaWithJavac
...
C:\android_projects\summit-app-android\app\src\main\java\org\openstack\android\summit\OpenStackSummitApplication.java:17: error: cannot find symbol
import org.openstack.android.summit.dagger.components.DaggerApplicationComponent;
^
symbol: class DaggerApplicationComponent
location: package org.openstack.android.summit.dagger.components
warning: unknown enum constant Scope.LIBRARY_GROUP
...
* What went wrong:
Execution failed for task ':app:compileDevelopmentDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
Thanks to Rahul I figured out how to solve this. As he mentioned the problem was that I was including different versions of guava. So first I ran this in Android Studio terminal :
gradlew -q dependencies app:dependencies --configuration compile
where "app" is your project. This showed me a list of all dependencies and saw that different versions of guava where being included.
Then I excluded each repeated version of guava from the included projects like this:
testCompile ('org.robolectric:robolectric:3.1') {
exclude module: 'guava'
}
Hope this helps someone :)
I have the following set up:
Project
spring boot app
java classes that are packaged into a jar
android project
app module of the android project
I am trying to set up gradle build so that i get runnable spring boot jar application, java jar library that is installed in the local maven repo and an apk file for the android.
To get an apk file I need to run assembleDebug task
To publish java ibrary I need to run publish task
To get spring executable I need to run compileJave task
Question is what task to run on the top level root gradel.build file to get different tasks accomplished?
root gradle:
allprojects {
task hello << { task -> println "I'm $task.project.name" }
}
subprojects {
repositories {
mavenCentral()
jcenter()
}
}
Spring Boot gradle:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
defaultTasks 'clean', 'build'
buildscript {
ext {
springBootVersion = '1.5.1.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle- plugin:${springBootVersion}")
}
}
jar {
baseName = 'demo'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('io.jsonwebtoken:jjwt:0.7.0')
compile('mysql:mysql-connector-java:6.0.5')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Java Proj gradle:
jar {
baseName = 'commonobjects'
version = "0.0.1-SNAPSHOT"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
Android Proj gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
Android App gradle:
def ANDROID_SUPPORT_DEPENDENCY_VERSION = '25.1.0'
def DAGGER_DEPENDENCY_VERSION = '2.8'
def OK_HTTP_DEPENDENCY_VERSION = '3.5.0'
def RETROFIT_DEPENDENCY_VERSION = '2.1.0'
def RETROFIT_JACKSON_DEPENDENCY_VERSION = '2.1.0'
def BUTTER_KNIFE_DEPENDENCY_VERSION = '8.5.1'
def JAVAX_ANNOTATION_JSR250_API_DEPENDENCY_VERSION = '1.0'
def GREEN_ROBOT_EVENT_BUS_DEPENDENCY_VERSION = '3.0.0'
def RX_JAVA_DEPENDENCY_VERSION = '2.0.5'
def RX_ANDROID_JAVA_DEPENDENCY_VERSION = '2.0.1'
defaultTasks 'clean', 'assembleDebug'
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "net.ltgt.gradle:gradle-apt-plugin:0.9"
}
}
repositories {
jcenter()
mavenCentral()
}
apply plugin: "com.android.application"
apply plugin: 'idea'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
// debug {
// buildConfigField "String", "PARSE_APPLICATION_ID", "\"1\""
// buildConfigField "String", "PARSE_API_KEY", "\"1\""
// }
release {
minifyEnabled true
proguardFiles "android-proguard-android.txt", "proguard-rules.txt"
// buildConfigField "String", "PARSE_APPLICATION_ID", "\"1\""
// buildConfigField "String", "PARSE_API_KEY", "\"1\""
}
}
packagingOptions {
pickFirst 'META-INF/LICENSE'
}
}
dependencies {
// Add jars supplied
compile fileTree(dir: 'libs', include: ['*.jar'])
// Test related
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
androidTestCompile "com.android.support:support-annotations:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
androidTestCompile "com.android.support.test:runner:0.5"
// Android support libraries
compile "com.android.support:appcompat-v7:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
compile "com.android.support:design:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
compile "com.android.support:support-annotations:${ANDROID_SUPPORT_DEPENDENCY_VERSION}"
// An HTTP & HTTP/2 client for Android and Java applications
compile "com.squareup.okhttp3:okhttp:${OK_HTTP_DEPENDENCY_VERSION}"
// Retrofit: A type-safe HTTP client for Android and Java
compile "com.squareup.retrofit2:retrofit:${RETROFIT_DEPENDENCY_VERSION}"
compile "com.squareup.retrofit2:converter-jackson:${RETROFIT_JACKSON_DEPENDENCY_VERSION}"
// Butterknife: Field and method binding for Android views
compile "com.jakewharton:butterknife:${BUTTER_KNIFE_DEPENDENCY_VERSION}"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTER_KNIFE_DEPENDENCY_VERSION}"
// Dagger DI
compile "com.google.dagger:dagger:${DAGGER_DEPENDENCY_VERSION}"
annotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_DEPENDENCY_VERSION}"
provided "javax.annotation:jsr250-api:${JAVAX_ANNOTATION_JSR250_API_DEPENDENCY_VERSION}"
// Event bus
compile "org.greenrobot:eventbus:${GREEN_ROBOT_EVENT_BUS_DEPENDENCY_VERSION}"
// RxJava a library for composing asynchronous and event-based programs by using observable sequences.
compile "io.reactivex.rxjava2:rxjava:${RX_JAVA_DEPENDENCY_VERSION}"
compile "io.reactivex.rxjava2:rxandroid:${RX_ANDROID_JAVA_DEPENDENCY_VERSION}"
}
You can simply create your task that will depend on three different tasks. It's possible to have dependencies across subprojects as well:
task myAllTask {
}
myAllTask.dependsOn assembleDebug, publish, compileJava
For running tasks from subprojects:
myAllTask.dependsOn ':bootProj:assembleDebug', ':javaProj:publish', ':androidProj:compileJava
I have got the following root build.gradle file:
buildscript {
repositories {
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 = "my_project"
gdxVersion = '1.5.4'
roboVMVersion = '1.12.0'
box2DLightsVersion = '1.3'
ashleyVersion = '1.7.0'
aiVersion = '1.8.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 fileTree(dir: '../libs', include: '*.jar')
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
...
compile fileTree(dir: '../libs', include: '*.jar')
}
}
project(":core") {
apply plugin: 'scala'
apply plugin: "java"
apply plugin: 'idea'
dependencies {
...
compile fileTree(dir: '../libs', include: '*.jar')
}
}
and ones for each module:
core
//apply plugin: 'scala'
apply plugin: "java"
sourceCompatibility = 1.7
[compileScala, compileTestScala, compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets {
main {
scala.srcDirs = ['src/main/java']
java.srcDirs = []
}
test {
scala.srcDirs = ['src/test/java']
java.srcDirs = []
}
}
compileTestScala {
scalaCompileOptions.fork = true
scalaCompileOptions.forkOptions.jvmArgs = ['-XX:MaxPermSize=2048m']
scalaCompileOptions.additionalParameters = [
"-feature",
"-language:reflectiveCalls", // used for config structural typing
"-language:postfixOps"
]
}
eclipse.project {
name = appName + "-core"
}
dependencies {
}
desktop
apply plugin: "java"
sourceCompatibility = 1.7
//sourceCompatibility = JavaVersion.VERSION_1_8
//sourceSets.main.java.srcDirs = ["src/"]
sourceSets {
main {
java {
srcDirs = ["src/main/java"]
}
}
test {
java {
srcDirs = ["src/test/java"]
}
}
}
project.ext.mainClassName = "com.example.my_project.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 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)
}
}
dependencies {
}
android
android {
buildToolsVersion "23.0.3"
compileSdkVersion 23
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/resources']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
instrumentTest.setRoot('tests')
}
defaultConfig {
applicationId "com.example.my_project.android"
minSdkVersion 10
targetSdkVersion 23
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
lintOptions {
abortOnError false
}
}
// 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() {
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.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"
}
}
}
}
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.mygdx.game/com.mygdx.game.AndroidLauncher'
}
// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
// need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
// ignores any nodes added in classpath.file.withXml
sourceSets {
main {
java.srcDirs "src", 'gen'
}
}
jdt {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
classpath {
plusConfigurations += [project.configurations.compile]
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
}
project {
name = appName + "-android"
natures 'com.android.ide.eclipse.adt.AndroidNature'
buildCommands.clear();
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
buildCommand "org.eclipse.jdt.core.javabuilder"
buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
}
}
// sets up the Android Idea project, using the old Ant based build.
idea {
module {
sourceDirs += file("src");
scopes = [COMPILE: [plus: [project.configurations.compile]]]
iml {
withXml {
def node = it.asNode()
def builder = NodeBuilder.newInstance();
builder.current = node;
builder.component(name: "FacetManager") {
facet(type: "android", name: "Android") {
configuration {
option(name: "UPDATE_PROPERTY_FILES", value: "true")
}
}
}
}
}
}
}
dependencies {
}
On my windows machine it's built having all three modules - core, desktop and android, but on linux no modules is found in project structure, except the project root folder. What could be the reason why behavior is different depending on platform type?
i'm using:
idea 2016.3,
gradle 3.2.1 (for the project default gradle wrapper),
groovy 2.4.7,
jvm 1.7.0_80
The problem was that android sdk should had been setup beforehand.
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}"