My app crashes when I try to use libraries (like Google Analytics or others).
I've searched on Google and found some help but it still doesn't work...
My lib folder is called "libs", I've got jar in the build path...
Have you got any ideas?
The error is :
java.lang.NoClassDefFoundError: com.google.analytics.tracking.android.EasyTracker
EDIT :
Here my conf :
Thanks.
If you're using Eclipse, try this
Select your Project with the Mouse
Right click->Properties
Select Android
Verify that you've selected the "Google APIs" version that you need for your project
At the bottom, your Libraries should also appear. If they don't
Click the Add button. Add the missing libraries. Careful, though, your libraries need to use compatible APIs to your main project.
Related
How to find latest version number of google specific libraries from repositories (jcenter etc..) to include in gradle dependencies in Android Studio.
For non google libraries generally I can make a search in jcenter itself. But not able to search google specific libraries there.
You may take example of following libraries.
com.android.support:appcompat-v7:25.1.0'
com.android.support:recyclerview-v7:23.3.0'
Yes as Tim mentioned in the comment Gradle tells you by highlighting particular dependency as a warning.
Trick to update dependency with latest version:
Let me also share a trick through which you can always include the latest version of the particular dependency.
Replace the version number with only "+" sign.
Sync gradle
Now select + sign and press ALT + ENTER, it will show you drop down menu with an option to select latest version.
If you have added a dependency, you can see them by moving the cursor to that library. It will show you a warning
You can then change to new library and sync your project.
Another way to use the latest libraries in Android Studio.
Right click your project and choose Open Module Settings. Project Structure window will appear. Select 'app' from the left pane and choose the 'Dependencies' tab. Include new library dependency by pressing the + icon. Search your needed library in the window opened up. Latest library dependency will appear in the suggestions and you can add them to your project.
The best way these days is to go to https://maven.google.com , where google now lets you browse all their libraries and see all the versions available, including the latest version. It looks like this:
You can even do a search for a specific library, and then expand/collapse as desired:
For the last 2 days I've been trying to simply get Google play game services Integrated into my game. I've followed the instructions here...
https://github.com/playgameservices/android-basic-samples/blob/master/README.md
...many many times. I have been trying to get it to build with Gradle but for now, I'll just focus on Eclipse building until that works. I've imported BaseGameUtils project into my workspace as an Android library project. My game android project has two Android library dependencies: google-play-services_lib and BaseGameUtils. Everything in Eclipse is showing without any errors. When I build and run on a real device, I see an error that says -
[2014-10-27 20:39:25 - BaseGameUtils] Could not find BaseGameUtils.apk!
I don't know why it's even looking for BaseGameUtils.apk since it should be an Android library. That said, I'm not sure how an Android library is really handled so maybe it should be a .apk. In any case, I couldn't find any information on this bug and the error message doesn't give me much to work with. I've tried adjusting things in the Build Path but no luck. I did have to remove some redundant dependencies in my Build Path earlier since I was getting some kind of duplicate DEX error but I'm not sure that's related in any way to this. I am desperate for help, anyone have any idea?
Can you try this? It has to do with conflicting methods of specifying that a project is a library.
I found the source of the problem!
It turns out that "with the new library feature, you don't specify the
Android projects you depend on in the Java Build Path section of the
Properties. You do it in the Android section of the Properties".
So all I had to do is go the Application Project's Properties, hit the
Projects tab, select my own library project and click the Remove
button. That's it. No more problem.
In Eclipse Java EE select the project Properties, then select Project
References, then check the FacebookSDK (see screen capture)
From: Android Eclipse - Could not find *.apk
If that doesn't help, you may want to double check that you selected "Is Library" in BaseGameUtils.
Also, when you hit "Run" in Eclipse, are you running your application and not BaseGameUtils?
Please would you check that BaseGameUtils has "is library" checked and that your application project DOES NOT have "is library" checked.
If this is correct, then please would you review the following in detail (especially as regards checking and unchecking "is library" ) :
Android Eclipse - Could not find *.apk
I presume that the DEX error related to two or more versions of the same lib. What is the specific GameHelper error ?
As a general point, I find it productive to get a sample project working first to ensure that I have got the environment working correctly before I start integrating game services into my own projects. If you have been changing the build path then it may be quicker to start from scratch and get a sample working. I have followed those instructions in the past and they are accurate.
I have a project target to API Level 10 and i want to implement the new ActionBar support library.
After follow all the instrutions in the Support Library Setup, when adding the library to my project I came across with dozens of error messages like this:
android-support-v7-appcompat\res\values-v14\styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.....
OK, i know that they are many answers to this question, but, after trying all the more obvious, i still could not solve the error.
I kept searching and found the cause, which is not so obvious, at least for newbies like me.
My intent is provide a full answer to help all those who are like me and do not master all the secrets of the Android development.
This is what you have to do for use the ActionBar support library correctly.
Follow the instructions in the Support Library Setup - Adding libraries with resources.
One thing that can bring some doubt is add the library to your aplicattion project:
(1) In the Project Explorer, right-click your project and select Properties.
(2) At the left pane select Android.
(3) At th bottom of the right pane click Add
(4) Select the library project android-support-v7-appcompat and click OK.
Click OK to close the properties window.
If you not get any of the errors I mentioned it´s all done.
However if you are like me, you dont´t followed the advice of Android team that suggests you always compile your source using the latest SDK, you get the error.
The error ocurrs because my Project Build Target was Android 2.3.3 and need to be at lest 3.0.
It was not immediately clear to me because of the fact that I'm specifically developing for Android 2.3.3 and I'm using support libraries.
OK, I hope this helps.
You should add that support library to your project. To add:
Right click on project, then go to :
properties > Java Build Path > Libraries
here Add External JARs...
add android-support-v7-appcompat.jar (path/to/sdk/extras\android\support\v7\appcompat\libs)
Additionally you also have to copy that jar to libs folder of your project, if it is not there automatically.
and you should use the #style/Theme.AppCompat theme for your application for support-v7 to be working
also keep one thing in mind you should change min sdk version to 11 if you want to support("android:windowActionBar")property in your project.
I have a working app that I've now converted to being a library project in Eclipse. When I attempt to include the library as a "Project Reference" in an empty app (no other functionality other than what it inherits from the library) it fails to build. I get the message Unable to execute dex: Multiple dex files define Lcom/facebook/android/R$attr;.
To try to work around this I tried to delete the Android Dependencies completely. But then I get a "Class not found exception" for classes in the library.
Is it possible to remove the Facebook dependency without also removing the app library dependency? I tried to delete the facebooksdk.jar file but was unable to do so since all the buttons are grayed out. (see screen capture below)
I also tried simply unchecking "Android Dependencies" in "Order and Export". That had no effect on the problem.
Your suggestions are welcome.
FYI, my project has 3 main components. All 3 are contained in the same Eclipse project folder (see screen capture):
Application "App_A"
Library_L (included as Project Reference in "A") It's worth noting that Library_L executes perfectly when I run it as a non-library project.
Facebook SDK 3.0.2 (included as Project Reference in Library_L (see screen capture)
Project References are used to include a library project (e.g., the Facebook SDK).
The documentation -- and books by balding guys -- show you how to attach an Android library project to your app, and it has nothing to do with "Project References".
Similarly, the documentation for the Facebook SDK shows you how to attach their Android library project to your app (see Step 6). They follow the standard Android library project approach, and that too does not involve "Project References".
Now, it is conceivable that there's something about a newer Eclipse version (I'm running Indigo) that causes "Project References" to show Android library projects as checked -- it does not do so in my version.
Make sure that you have properly set up the Android library projects, and see if that helps with your issue.
I am writing a MAP APP using Android Google Maps V2
But i am facing dependency problem, please see below images:
as you can see in above screen shot i am getting RedAlert Sign over Project Name
and as you can see in above screen shot getting RedCross over Android Dependencies
#ChulbulPandey
In Eclipse open Project -> Properties. Select Android on left. Check on the bottom that you have a reference to Google play services with a green checkmark. If not, click Add and add the google play services library
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
I am not sure but you can try this.
In Libraries tab remove the Google Maps V2 jar and add it again.
First, try changing project build target to something higher and then clean then build your project.
If that doesn't solve your issue then removing your external jar files linked and then import it again.
You must import google-play-services_lib library project from SDK and add a dependency to it from your project.
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
See link