I'm using joda time (version 2.8.2) library in my project and everything works fine, but I'd like to use the specialized version for Android, as explained here: dlew/joda-time-android
While it was easy to add the joda time jar to Android Studio and adding the dependencies to the project, I didn't understand what to do in this case.
What do I have to download, where to put it and how to configure it.
Is there someone who did it and can write a step by step guide?
Thanks
Message update: I don't know why the question got two downvotes. I researched on Internet before posting the question. I also tried to contact the developer who posted the library on github. I didn't find an answer and it doesn't seem to be a stupid question, because I'm not getting tons of answers. I know I'm not an expert and for this reason I'm askingfor help, but before doing this, I always try to find a solution by myself. Thanks
Add this to the build.gradle file of your app:
dependencies
{
compile 'joda-time:joda-time:2.9.4'
}
In Android Studio Choose File>Project Structure. Then click dependencies tab in project structure. Click the + symbol (upper right corner) and choose library depencendy and type net.danlew in search bar. Click on net.danlew:android.joda:2.9.9 (current version as of today) if not already highlighted and then choose OK.
Hello I am trying to learn a little bit of facebook-sdk for android but no luck.
I will post some screenshots so you easy understand what is my problem.
1st step I am adding the SDk to my project
2nd step I import Classes but i get an error
And when I am going back to android tab I see this
Really need help. I tried Many times to follow the steps from FB Guide in case I forgot something but didnt helped... Thank you in Advanced.(I am new to this hope you will understand)
Your "Jar mismatch" problem comes into picture because of the Facebook SDK itself has android support v4 jar as well as your project also same jar file.
To solve this problem..
Go to your project's properties -> Java Build Path -> Order and Export :
Now remove the Tick-Mark from Android Private Libraries.
make sure that you had already used facebook SDK's private library (tick-marked)
And then after clean your work space..
It will always help me..
Hope this will help you to solve your problem.
Why am I having such a hard time getting into the swing of Android development? I've been developing in various languages over the years and, for some reason, just can't seem to get beyond that "jeez-i-still-feel-a-total-noob" stage with Android.
So I'm trying to add an Action Bar to my Android 2.3.3 project. No problem, right? The Android developers website has a nice and clear article explaining exactly how to do it. Of course it involves adding the appcompat v7 support library. No problem, even this is documented step-by-step on this page. But, as with just about every such exercise in Android, I find that you can do exactly what the page tells you to do, it still won't work without significant amount of Googling to fix the errors that you encounter afterwards.
So I've followed the steps under "Using Eclipse" in the section "Adding libraries with resources" in the above link. The first error I get is Unable to resolve target 'android-16'. No problem, this one I could figure out for myself but I'm curious, is there anything in the documents I've been following that would have suggested to me that I need Android 4.1.2 (API16) installed? Did I just read right over it or should I have known by myself that, to do what I'm trying to do, I would need API16?
Never mind, at least I can fix that but then I get a new problem. As soon as I add the android-support-v7-compat library to my project and click the OK button, the console output lights up with errors, the first one being:
C:...\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.ActionBar'.
and the other 60 odd errors are similar but for different given names.
I would really appreciate if anyone could help me out here. Obviously I'd like to know how to solve this particular problem but if anyone could give me some tips on how to get past this very frustrating stage of learning this new development environment, I would be ever so thankful. What is it that I should have done differently not to run into these kinds of errors, other than following the instructions on the Android Developers website step by step?
OK, I guess I should post an answer as I've eventually managed to solve my own problem.
It turns out I have to use a build target of Android 4.2.2, regardless of the fact that I'm specifically developing for Android 2.3.3 - I mean, that's why I'm using support libraries after all. I imagine it might be possible that some other lower target (but higher than 2.3.3) would still work I just used the highest one I have installed and it solved the problem.
How I was supposed to know this from following the step-by-step instructions on the Android Developers website is a mystery to me. The reason I decided to try changing the targetSdkVersion was because of the final section in the page referenced in the question. It reads "If you are increasing the backward compatibility of your existing application to an earlier version of the Android API with the Support Library, make sure to update your application's manifest." Now I'm not increasing the backward compatibility of my existing application. I'm changing an existing application that targets 2.3.3 to be able to include an Action Bar (seems more like "forward compatibility"). I tried upgrading the targekSdkVersion though as I was out of ideas and lo and behold, it worked.
Don't know if it helps you at all, but I've been struggling with a similar issue for several hours and finally managed to resolve it. In my case, inside my own project's styles.xml file, I was referencing the AppCompat style in the wrong way in the parent attribute.
I was using:
<style name="AppBaseTheme" parent="android:Theme.AppCompat">
where I should have used:
<style name="AppBaseTheme" parent="#style/Theme.AppCompat">
My mistake was in the reference to the theme.
I found that setting the Android target to 2.3.3 for the library project android-support-v7-appcompat solves this issue. You don't need to set your project's target higher, but the library's target lower.
You have pinpointed the all important document and the relevant section "adding libraries with resources":
http://developer.android.com/tools/support-library/setup.html
The error suggests that your project is not able to find these resources. Please double check the following :
You have checked "is library" on the library project
You have exported the jars IN THE LIBRARY PROJECT as described in that section
You have added the library project as a reference to your app project
You have added the android-support-v4.jar to your libs folder in your app project
If this is all definitely correct, check eclipse for any error messages - is it the library project or the app project that lights up like the proverbial Christmas Tree ?
First of all check if you have done all the described steps as explained on the developers site. Then, for the errors :
Unable to resolve target 'android-16'
Make sure that you have installed API16, this errors occurs if you have mentioned your targetsdk to 16 in your Manifest while the sdk for API16 is not installed. You can either install the API or edit the targetApi of your project to the minimum required version, for the support library you are using I think API 11 is the minimum required android version.
android:Widget.Holo.ActionBar
This error should also be fixed once the targetsdk is fixed in your project. Since to use Holo.ActionBar you'l need to target your project to minimum supported api level ie. 11 or higher.
I met similar problems. Using API 18, ADT.
To solve the "Unable to resolve target 'android-16' problem", I remove the import lib project and repeat what the tutorial says.
Then I found I couldn't really "add" the library to my project. (The instruction "In the Library pane, click Add." there is not that detail.
1. In your project -> properties -> Java build path -> Libraries -> Add Library... -> Android Classpath Container -> Select the lib project
2. In your project -> properties -> Android -> add... -> choose the lib -> apply
cheers
Here is how I avoided the error, " Unable to resolve target 'android-16'", when adding v7.
First, I followed the instructions for adding support libraries with resources in eclipse. Following step 4, I clicked Finish. That's when I saw the error message, android-support-v7-appcompat] Unable to resolve target 'android-16'.
Second, I read this post. I also opened the download manager, but did not need anything updated. In order to make sure that I followed the steps exactly as correctly as I could, I deleted the android-support-v7-appcompat project and started over.
This second time I didn't check any different boxes, after all. But, I also got no errors at step 4. Who can say why?
Thanks, Dewald, you expressed in this question the same frustration I have. Is experience the only way out?
If some of your resource xml files cannot find their respective AppCompat references, make sure you also add the support libraries to your project properties. You do this by:
1.) right clicking on your project in the project
2.) Select properties. (Bottom of the menu)
3.) click Android on the left hand side menu of the new pop up window
4.) In the libraries section, click the "add button"
5.) Select the respective libraries. (If none show up, check to see if they are already displayed in the "libraries" window of the pop up menu. If there is a red x by the desired library, try and resolve that issue first.)
6.) Once there is a green checkmark next to the desired libraries, make sure the "Is Library" option in the libraries section IS NOT selected.
7.) Click apply.
8.) Close the pop up menu.
If this doesn't work, let me know and I can help you out. I spent three hours on the problem so I know pretty much all the possible things that can go wrong with the set up.
Go to Project -> uncheck Build Automatically
Go to Project -> Clean... , clean both the library project and your app project
Export your app as a signed APK while Build Automatically is still disabled
I have been working with Java for about a couple of months now and I have been stuck introducing Google API into my Maps app. I need some help with these imports.
Here is what I did: I was following the code of a Places API demo which I can link if needed. I ended up having to add some libraries. Before I did, I was getting errors from all of the imports that started with com.google.api.client...etc. Then once I added all of these libraries, I then got left with 2 errors out of my imports.
The errors are: the "com.google.api.client.googleapis.GoogleHeaders" and "com.google.api.client.http.json.JsonHttpParser". I am receiving them both as "cannot be resolved to a type". These errors are causing some more errors throughout the rest of my code. I was hoping someone can help me solve this. I know it should have something to do with my code, but I am not sure what is going on. I know I am missing something.
Also, I installed the Google Plugin to install the APIs and when I did, I added the "Google + API" and the "GoogleOAuth2" APIs and that is where I am stuck at. Please someone help.
Here is the screenshot: Full Screenshot
I haven't worked with Maps, but as I understand it Maps is now packaged with Google Play Services, which I have been working with recently.
Firstly, the installation of Google Play Services is well-documented and you should look at this (if you haven't done so already):
http://developer.android.com/google/play-services/setup.html
There are a few areas that cause difficulty, and one is the section "Set Up a Project with the Library". There are different possible approaches but I suggest you take the following steps.
Ensure that the Google Play Services lib (and any other libs) are defined as library projects (Properties ...Android.. Library ...IsLibrary) and that they have no errors (cleaning may not be sufficient - you may have to shut down Eclipse to remove the errors).
When the library projects are error free, add them to your project. The normal way of doing this is to REFERENCE them (check what the documentation says) but you do this by (Properties ...Android.. Library ...Add).
Then check out (Properties ... Java Build Path ...) - read the documentation but you need your libs in here.
Then clean your project but note that a restart of Eclipse may be necessary to remove the errors from your project.
There are other errors that can arise - another common one arises if you have different versions of the v4 support lib in your libs / project and you get a message "...this check is based on SHA1 at this time". This is well documented on Stack Overflow.
Good luck !
Hey I know this was asked before, but none of the solutions seem to help.
This is NOT a duplicate
I have used the Facebook SDK before on an earlier project,
now I started a new one and I get this weird error.
I have set a reference to the library
I have set the Facebook SDK project as a library
I have tried deleting it and re-adding it according to the official documentation, and basically tried everything in this question.
Though I still get this error and can't find out why.
Worth to mention, when I tried to use the facebook class, it gave me an error with an option of "fix project", which I did and still didn't work, might be related?
This is common error. Just remove FacebookSDK project from Properties->Java Build Path->Projects . This project should be referenced from Properties->Android
For more information, see this answer: Could not find Library.apk!
Well, after alot of searches the only thing that worked for me is just creating a new project and copying all the files to it.
I tried avoiding it but that seems like the only thing that works =/
As there is no answer on this topic whatsoever, so if someone could find out a better solution - it will be very helpfull to the community
Hmm.. I just want to ask whether did you import the Facebook SDK into Eclipse itself? Because I had did a project using Facebook and the thing is that besides referencing, the guide I followed actually instructed that the SDK must be imported into the Eclipse.
You might probably want to have a look at this. Else, the other way is just like what you did, copying all the files.
Try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.
i dont know how this is happened but it works :
first : i have added all facebook3.0 related sample + facebookSDk projects in one workspace .
second : i have run a sample project . in which i found a .jar file :
androiddependencies->facebooksdk.jar (note this exact path )
third :
1.) i created my project .
2.) inside this i have removed errors by :- FixProjectSetup (atLast position )
3.) i have added facebooksdk.jar by right_clicking at project->properties->android->by checking android 4.2 + reference the Facebooksdk -> done .
now i am able to create and run programs easily .