Android Studio not working with HoloEverywhere and ActionBarSherlock - java

I was able to import both ActionBarSherlock and HoloEverywhere into Android Studio but I cannot get my app to compile.
screenshot:
https://docs.google.com/file/d/0BwOn70drOiMfZHZVeXdEVzNXRXc/edit?usp=sharing
For whatever reason my intent's seem to be freaking out and even though the library imports seem to be working fine, I'm also getting the following errors trying to emulate my application:
java: /Users/patdugan/usmc-pro-fitness-abs-he/src/com/patdugan/usmcprofitness/USMCProFitMainActivity.java:16: package org.holoeverywhere.widget does not exist
Anybody have any thoughts?

I just had this issue.
What you need to do is go to File > Project Structure... and click on Modules. Make sure that ActionBarSherlock has the support library under its Dependencies tab. If not, click the plus at the bottom and add a Library (You may have to click New Library... to select the libs folder within the sub-project).
After this is done, change the scope to Provided so that you don't get lib conflicts when compiling your app.

Holoeverywhere doesn't use ActionBarSherlock anymore, it now relies on the ActionBarCompat library.

Related

Android - Eclipse project making and R file error

I'm having issue with Eclipse and I work in android. This issue happens when I create a new project and when I click finish, It auto generates the project without R file and The project creating window doesn't closes and I have to close it. I have many old projects which work fine(Until now) and the issue is only coming when I make a new project. I also get a error in Styles.xml file saying that "Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'". When I press CTRL+RightClick onto R file then it takes me to a window which says "Source Not Found". If you have any solution for this, Please post your answer under this question. Thank you!
EDIT: Appcompat error was solved later.
To solve missing R in generated java files, make sure that Android SDK Tools and Android SDK Build-tools are installed and updated in SDK Manager. Then, make sure Eclipse is updated. After this, clean your project and rebuild.
To solve No resource found "...AppCompat...", make sure Android Support Library is installed and updated in SDK Manager. Then, the AppCompat library can be found at:
android-sdk/extras/android/support/v7/appcompat
You need to reference this AppCompat library in your Android project.
Import the library into Eclipse. To do so:
Right click on your Android project. Select properties. Click 'add...' at the bottom to add a library. Select the support library. Finally, Clean and rebuild your project.

Stuck with first time java for android

guys, with my friend started working on a school project - developing a java app for android. He started it, now it's my turn to do my job, so i got the code he already has, set up Android SDK for Eclipse and downloaded all the neccessary files and packages, but it still gives me errors and I can't even run the project.
One of the errors (the main one, I think) is that it can't import android.support.v7.app.ActionBarActivity
If anyone knows what can I do (I've tried all kinds of solutions from the internet, but none work) I would be very grateful.
Here is a screenshot of the code
http://s17.postimg.org/8aw952lha/Capture.jpg
See if you have imported the ActionBar project to your Eclipse workspace, also, right click on your project->properties->android and check that you have referenced/linked the ActionBar project there.
If you are using a repository without the proper ignore files it is possible that you have imported your partners configurations and then have the references to the auxiliary projects broken (you just need to update that).
Hope it helps.
android.support.v7.app.ActionBarActivity is a support library. This allows older versions of Android (before native support for an action bar was available) to use the action bar.
Since you are having difficulty importing it, I'd assume you do not have the support library installed.
Full instructions are available here:
http://developer.android.com/tools/support-library/setup.html
A snippet for adding support libraries to Eclipse:
Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a libs/ directory in the root of your application project.
Copy the JAR file from your Android SDK installation directory (e.g., /extras/android/support/v4/android-support-v4.jar) into your application's project libs/ directory.
Right click the JAR file and select Build Path > Add to Build Path.

ActionBarSherlock and Another Project's Have Conflicting Support Version 4

This is an error I know how to fix but its getting really annoying and happening every time close and then open eclipse again. I am in the process of making an Android app that uses the Action Sherlock library. I imported Action Sherlock into my workspace and my other project sees it as a library on its build path. However to successfully run my application and not get an error relating to a Jar Mismatch!, I need to uncheck the support version 4 contained from the Order and Export screen in the Action Sherlock project. After this the app runs successfully and works fine. However, if I close Eclipse and then open it, it seems like the build path somehow resets itself!? The support version 4 library that I had previous unchecked in the Action Sherlock project is checked again. Because of this the project won't run.
Is this some kind of a bug in Eclipse? I guess I could always delete the support library in Action Sherlock but I'm afraid to do this as it will break my app. Has anyone ever ran into this problem before or am I the only one?
Any answers or help would be greatly appreciated!
You should be able to copy your version of the support library over ActionBarSherlock's without any trouble. Then it won't matter if you check order and export because there won't be any conflicts between the jars.
Either delete the supportv4.jar from your project and use the one bundled in ActionBarSherlock, or update the supportv4.jar in ActionbarSherlock and then delete the one in your project. You see, the conflict arises because with ActionBarSherlock comes a version of the supportv4.jar, so your classpath has two versions of the same jar.

How do I fix these missing libraries?

So these are the three missing libraries, that I still didn't manage to add to my imported project. I tried a lot of things and it simply won't work. I downloaded google play services with SDK manager and google-play-services_lib isn't there, while google-play-services is there, but I need both. As for CaptureActivity and PortraitQR, I tried adding both jars from the project dexedLibs but it didn't work. I also tried downloading this but I don't know how to add it to the project (I only know how to add single jars)
EDIT: Okay so I played around a little bit and I think I'm closer to a solution now. I manually added google play services lib and capture activity and this is how libraries look like now:
The only remaining problem is that now there is a red exclamation mark next to my project and when I go to build paths there is this red error:
I tried to look for captureactivity.jar but I can't find it. Can anyoe help me out here?
you should import them with new project->Android project from existing code-> then locate your projects path and also make sure you make them library project; right click on project-> properties-> android -> scroll to bottom and check 'is library' checkbox
and the path for google play services lib is =>
\extras\google\google_play_services
you can also find sample code on there
These three are library projects. Let's say you have a project in your IDE which is called "PortraitQR". It must be open before your project, Evanturist, can see it as a library project. And it's the same story for the other two library projects. If it doesn't work, try removing them in the dialog you've shown here and adding them again.
You should not use any .jar files for this to work. You should have these three projects open in your IDE.

jfeinsteins slide menu implementation java/ adding a library as a dependency

So I'm trying to implement jfeinsteins slide menu into my application, but before I do that I want to get a good demo, so I know how to implement it. Problem is that I'm stuck.
this is where I'm getting the library.
https://github.com/jfeinstein10/SlidingMenu
This is the project I'm trying to implement it in.
https://github.com/baruckis/Android-SlidingMenuImplementation
I did this part for the set up.
In Eclipse, just import the library as an Android library project. Project > Clean to generate the binaries you need, like R.java, etc.
,but I'm not sure I'm completely understanding this part.
Then, just add SlidingMenu as a dependency to your existing project and you're good to go!
how do I add slidingMenu as a dependency. Also, the error I'm receiving is SlidingMenu cannot be resolved to a variable, SlidingMenu cannot be resolved to a type.
Please can someone help me answer this!? Am I close?
To add a dependancy to an existing project, select the project containing your code (the one you want the dependancy to attach to), right click the project in the Package Explorer and select Properties.
In the Properties window, select Android and ensure that the library projects are added in the Library section. Click add to add an existing project in the workspace to the project as a dependancy.
It may also be worth checking dependancies in the Java Build Path too. Here you can ensure the correct .jar files are correctly assigned to your projects.
I was stuck at this place too. Please follow the below steps.
After downloading the library. In eclipse, go to New->project->android existing project
After downloading SlidingMenuImplementation, add this to eclipse similar to the way above.
I hope till here you have done. Next, right click on the SlidingMenuImplementation project --> properties --> Android --> Below the target window, you'll find references.
Add the Slidemenu library there. Once done clean the project. The errors are gone.
Please note, this supports only Android 4 and above. For lower versions use ActionBarSherlock.

Categories