How can I build BaseGameUtils with Gradle - eclipse

I had a project that was working fine until I imported the BaseGameUtils library project for use with my project.
Is it possible to continue to use Gradle to build my project? I tried the Google Play Game Services in LibGDX instructions. Even though they are for IntelliJ - I would think the instructions would work for Eclipse but they don't.
The error I get is
A problem occurred configuring project ':android'.
Configuration with name 'default' not found.
This is from adding the line compile project(":BaseGameUtils") in my :android dependencies in build.gradle.

You don't need add this project to Gradle. Just import BaseGameUtils to Eclipse, then set it as a library
Right button on BaseGameUtils > properties > Android > check "Is a library" > click ok
Then go to your Android project (not the core project)
Properties > Android > Add library > select BaseGameUtils
Try to follow LibGDX Google Play Game Services Tutorial.

Related

Convert Facebook Android SDK .aar file to Java Library Project

I'm trying to convert facebook android sdk .aar file to Java Library Project (and use it in Unreal Engine 4 as OnlineSubsystem).
What i've done (according to this answer - AAR in Eclipse ANT project):
Download facebook-android-sdk-4.10.1, unzip it, rename facebook-android-sdk-4.10.1.aar to facebook-android-sdk-4.10.1.zip.
Unzip facebook-android-sdk-4.10.1.zip.
Create in Eclipse new android java library project.
Add classes.jar (from facebook-android-sdk-4.10.1.aar) to libs of Eclipse project.
Replace res folder of eclipse project with res folder of .aar file.
Create new android application and add facebook library project to android application project.
Copy all from facebook .aar's AndroidManifest.xml to android application project.
When I'm trying to build application I always get these errors:
res\layout\com_facebook_device_auth_dialog_fragment.xml:22: error: No resource identifier found for attribute 'cardBackgroundColor' in package 'com.facebook'
res\layout\com_facebook_device_auth_dialog_fragment.xml:22: error: No resource identifier found for attribute 'cardElevation' in package 'com.facebook'
The CardView declaration (with errors) look like this:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="#android:color/transparent"
card_view:cardElevation="10dp">
When I delete these two attributes everything works fine, but I want to know how to build my project without deleting anything.
Unreal Engine uses ant build system for building android application so, please, do not offer me to use gradle.
Thanks.
I realized that I should add cardview java library project from android sdk (android-sdk\extras\android\support\v7\cardview) to my facebook java library project.
Thanks everyone.

I couldn't build Jhipster sample app

I'm trying to run Jhipster sample app in my Eclipse kepler . I've downloaded the project from here and I've imported it as existing maven project but it couldn't be build . I got this exception :
The type java.util.Optional cannot be resolved. It is indirectly referenced from required .class files AccountResource.java
and many "Undefined CSS file" errors
how can I run this project in my Eclipse ?
Normally you should create your application using the yeoman generator. Install yeoman and execute yo jhipster from your command line.
a)For the java exception basically you need to remove the old version of java from your build path and add support for java 8.
You need to follow these steps
1) Right-click on project » Properties » Java Build Path
2) Select Libraries tab
3) Find the JRE System Library and remove it
4) Click Add Library... button at right side » Add the JRE System Library(Workspace default JRE)
Do not forget to set the Java jdk compiler compliance level to 1.8 (Preference -> Java -> compiler )
b) The jhipster site mentions about the configuration settings(css,javascript and html etc)for eclipse to avoid errors in eclipe. https://jhipster.github.io/configuring_ide_eclipse.html

Failed to resolve: com.nineoldandroids:library:2.4.0 in android studio project

I exported a project from eclipse and import it to android studio.in that I added on my project the library dependency com.nineoldandroids:library:2.4.0, from the Project Structure dialog of Android Studio, but when I build the project with gradle (with the Sync Gradle button), I get the error "Failed to resolve: com.nineoldandroids:library:2.4.0" .but when i am adding that same lib dependencies to a project which i have created in android studio,there its working fine.can anyone plz help me.what is the problem?
Open your android studio,click File->Settings,in the search box type in "gradle"
On the left side,under "Build Tools",there is "Gradle",click it
Then,on the right side,you will find "Offline work",yours maybe checked,make it unchecked
Click "OK" to finish the operation
Finally Sync Project with Gradle Files again
You can have a try

Getting "Unable to execute dex: Multiple dex files define" error when trying to run main project which is using other library project

I am trying use androidVNC open source project as a Library Project in my MainProject. androidVNC has also used ZoomerWithKeys library project. I want start a activity of androidVNC library project in my MainProject by clicking on a Button.
I have done all the basic things like to define all the activity of library project in Manifest of main Project.
The problem is that i am getting following error when trying to running my MainProject -
Dex Loader] Unable to execute dex: Multiple dex files define Lcom/antlersoft/android/zoomer/R$drawable;
[2013-05-16 15:44:03 - OtherProj] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/antlersoft/android/zoomer/R$drawable;
Thanks in advance.
I resolve this by doing following steps:
Go to bin folder of you app and see which libraries are duplicated(in mine I had 2 supportv4****)
Hold your mouse on them and see where they compile from, keep in mind that you should keep the most important one, so if you are using appcompat and facebookSDK, you should keep that library which comes from appcompat
Go to the properties of the project of the other library (e.g facebookSDK) -> Java build path -> Libraries and delete the dependency in which the buggy lib come from(in mine, supportV4 nested in Android Private Libraries, so I delete it),
Also do it from a file manager, go to our project folder/libs and delete that buggy library if it's not cleaned by default
In that window, after deleting, choose Add Jars... and select the library of the other project(in mine, I choose SupportV4 from appcompat)
Clean you workspace, restart Eclipse
The problem should have gone, these steps work more than fine for me
1).did you added your lib project to the main project?? Make sure..
2).also add the project to your lib project by doing this process--
In the lib project-->>right click on project-->>java build path-->>on the project tab-->>add your main project.
Now build your project..hopefully it will help you.
EDITED::
3). Go to the project properties..edit this(can give some space) and then save..clean project...then build..
I tackled with this kind error in Android Studio.
In my case my main project was using two my own lib. But beside this those two libs were using the same library as external included
compile files('lib/external-lib.jar')
I solved it by doing following in my both own libs.
1)Removing old compile files('lib/external-lib.jar' ) from build.gradle and deleting old external_lib.jar from lib folder.
2)Adding library from jcenter() two my own libs
compile 'external.lib:1.9.2'
3)Rebuild.
Then rebuild and run main project
Then problem has disappeared.

Android SDK tools rev 19: Issue with external jar files

I know this question was asked a couple of times on stackoverflow - but I still face some problems trying to add an additional jar file to an existing android project - using android sdk tools rev. 19.
Summary:
I use eclipse Version: 3.6.2
The project compiled and the artefacts worked with android sdk tools rev. 14/any android >2.2 (>= API 8)
The project does compile with sdk tools rev. 19/any android >2.2 BUT the artifacts do not contain the jars defined within the classpath - so I keep getting java.lang.NoClassDefFoundError exceptions
I tried to add "jar.libs.dir=lib" to my project.properties - since lib contains all the jars without any positive effect.
I also tried to create a new dummy project adding jars as I always did (all jars added to a lib folder within the project, right click on the jar > add to build path)
I tried to add the jars using import
Thank you for your help.
Rename your "lib" folder to "libs".