Having build path problems after importing AppCompat library - android

I'm trying to design a simple hello world application with material design using Appcompat. I imported the v7 libraries into the workspace (I use eclipse btw) but after this, my other projects and also this one started showing this red exclamation mark indicating build path problems. when I checked it, the android dependencies in project>properties>Java build path was showing an error. Removing android dependencies would temporarily remove the exclamation but android dependencies would rebuild and bring the errors all over again. when i run my material application, i get the following error "
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable" i tried rebuilding the library but got the same problems. what am i doing wrong? Any help is appreciated.

You delete support v7 lib on current workspace
Project -> properties -> remove inclused v7 lib
Clean project
reimport v7 lib from SDK-DIRECTORY/extras/android/support/v7/combat
click "v7 on your workspace" -> Properties -> click to choose "is Library" if it not be checked.
Android Project -> properties -> add lib -> choose "v7 on your workspace"
Reclean project.
-> Wait -> OK

Ok i found the answer myself (eclipse did it btw). it was that i had to rename all the jars of the support libraries in their bin folders to match what it said it should be in project->properties->java build path->android dependencies. like my support library for appcompat was named something similar to appcompat-v7-support and its jar held the same name. eclipse said that appcompat-v7.jar was missing from the bin folder so all i had to do was rename my jar. Fairly simple yet annoying. i leave this post for others to refer.

Related

Importing an app-compat v7 library eclipse project to android studio

I have an Android application created in Eclipse, now I want to import it to Android studio, when I import project I get the following error
Project FinalProject Integrate:/home/vishal/Android_Workspace/FinalProject Integrate/project.properties:
Library reference ../android-support-v7-appcompat could not be found
Path is /home/vishal/Android_Workspace/FinalProject Integrate/../android-support-v7-appcompat which resolves to /home/vishal/Android_Workspace/android-support-v7-appcompat
and it is an unrecoverable error.
Here's what I did: In the the project.properties file I deleted all dependencies, and while importing project in Android studio I simply followed the instructions (making sure the check box are ticked, especially the one that says add any dependency). And it worked.
Edit your build.gradle, remove the dependency of project appcompat-v7
In Android studio, Go to main menu, File -> Project structure -> Dependencies, click add icon on the right side, and add appcompat-v7 as a library dependency.
Try this: Go down to the folder where the workspace and there copy the project to another folder, then open the Android studio as administrator and try again.

How to import an existing Android Library project into Eclipse workspace

I see there are powerful support projects out there like this one: https://github.com/JakeWharton/Android-ViewPagerIndicator
All the tutorials and posts I have found describe:
what an Android Library Project is
how to create one from scratch
how to reference one after it's already in your Eclipse workspace
But I haven't found the correct steps for how to do an import into eclipse for such a project.
I have tried to create an empty Android library project and then copy over the files; and then also tried to link to the library project root folder in the eclipse project config for another empty project. Those didn't work.
So my question is .. what's the correct way to import the ViewPagerIndicator project into my Eclipse workspace?
Thanks
Right click on Workspace - > Import -> Existing Android Code Into Workspace -> Library Folder
Note:
To avoid other inconveniences, do this:
1) Once is already in your Workspace, make sure that the project is marked as "Library." Right click on Library -> properties -> Android -> Check Is Library
2) At the time of importing, change the name of the folder. Please, specify something different than just "library". Projects on github usually come that way.
3) Make sure that every file is in the folder. For instance, Eclipse won't import anything if project.properties is not inside the Library folder. In a similar situation, Eclipse could import the project, but it would not create the R.java file if something is missing or there are errors in the layouts of the library.
4) Make sure that all dependencies match with your project. For instance, if certain library needs android-support-v4.jar, make sure that both (project and library) share the same version of the file. Once again properties -> Java Build Path -> Libraries -> Add or remove Jars
5) To make your project dependent of the imported library, Right Click on the project -> properties -> Android -> scroll until the end and add the imported library.

Appcompat does not work

I am trying to use appcompat in my application. I have done everything according to the instructions. But when I add android-support-v7-appcompat as a library in my proect, I have an error like so:
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library
'C:\Android\workspace\android-support-v7-appcompat\bin\
android-support-v7-appcompat.jar'
testActionBar Build path Build Path Problem
what am I not doing right?
delete appcompat.jar and v4-support.jar from libs folder
clean ur project
How to add android-support-v7-appcompat as a library
import android-support-v7-appcompat in eclipse as a library project and
check copy into workspace
add android-support-v7-appcompat as library in ur project
right click on ur project -----> properties ------>android
------> add
clean ur project
I think this will help u
Before creating the project, run eclipse as Administrator so that it creates the jar in the location that it is referencing to.
Right click the eclipse icon and select the option"Run as Administrator"
Just do the following steps
appcompat_v7_nn right click build project;
click to your project, project clean
Delete jar library from every directory you add. Then you need to add appcompat as a dependency. If you use Android Studio, you need to do as following:
add this
compile 'com.android.support:appcompat-v7:18.0.+'
into your gradle dependencies and after that, Build -> Rebuild Project.
With "compatibility" files problems you can try to delete / or rename for security any appcompat "project" in eclipse and create a new project using a compatibility mode (different target and "required" SDK values, equals to your version needs), it will generate a new appcompat project, remember to link your existing project to this appcompat project and check your lib for no duplicate compat. jar.

Can't add project as library to my project

I'm trying to use ABS library in my project. I added library project to my workspace, checked this state ("Is Library" is true in project's settins), added this project to my one "Java Build Path" -> "Projects". But I can't mark this project as library ("Android"->"Libraries" in properties). I had added that, but when I opened it again, I saw that project hadn't been added. How can I fix it?
Undo this step:
added this project to my one "Java Build Path" -> "Projects".
You only need to add a library project project under the Android -> Libraries in properties
Check your files to see if they are read-only, especially build.properties.
If you use source control, they will tend to be set to read-only and Eclipse doesn't seem to provide any warnings when it needs to write to these files and can't -- you'll check the box, it looks good, then you exit and reload and it's unchecked!

ActionbarSherlock not working

I am having problems getting start with the ActionBarSherlock. I downloaded the 4.1.0 version and followed the following tutorial for installing it.
http://www.youtube.com/watch?v=4GJ6yY1lNNY
The Problem I am facing is whenever I make a new project and add the library project of ActionbarSherlock to it. I get the following error.
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'C:\Work\JakeWharton-ActionBarSherlock-4.1.0-0-g9598f2b\JakeWharton-ActionBarSherlock-88fc341\library\bin\com_actionbarsherlock.jar' myapp Build path Build Path Problem
Please anybody help me with it.
I just had the same problem: A .jar file is requested, but non-existing. Also, it is okay that the file doesn't exist, because we want to use a Android-Library Project and not an included jar-library.
The steps described by Aqif Hamid are perfectly fine, if the missing import (.jar or library project) would be the root of the problem. But i figured out that the reason for this error is that you have to set both projects (AndroidBar Sherlock and your own Android project) to Java Compliance Level 1.6
To do so go into Project Properties => Java Compiler and set the level to 1.6
Of course, you have to install JDK 1.6 on your computer...
Hope this helps you too!
The only thing that it works for me was selecting at Properties at Java Compiler Tab Compilance Level --> 1.7 (It was 1.6).
After that Android Tools, Fix Project Properties
DO the followings:
just like you have bin, res folders. right click on your project and
add a folder named 'libs' (if libs folder is not already there).
Then copy paste your com_actionbarsherlock.jar file in this libs folder.
Right-click on your com_actionbarsherlock.jar file and click Add to Build Path.
Now clean and build your project. You should be good to go.
Edit:
To add project as a library do this:
Make sure you have your library project in your projects list and it
is open.
Right click on your project in which you want to add your library
project and select Porperties.
Click Android in properties windows, now scroll down, you will see
library section at the bottom. There press Add button.
Now a window will open in which you will see list of library
porjects. Select your required project and press Ok. Now that library
project must be there with a green tick mark.
Press Apply and Ok button.
You should be good to go now.
regards,
Aqif Hamid
I am of the understanding that you cannot include ActionBarSherlock into your project by adding a jar to your lib directory (or just including the jar at all). You will have to create an android project for ActionBarSherlock then link to it as a library:
Create ActionBarSherlock project in Eclipse
Right-click your project and go to Properties
Select Android in the left pane
Then in the right pane, towards the bottom you can Add... the ActionBarSherlock project you created in step 1.
If you are curious why the jar approach doesn't work, I give you Jake's reply in this thread
(although that's a month and a half old at this point).
1 - create a libs folder (parallel to manifest) and put the jar in that
Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar ->
yourjar.jar
This video might be useful in case you are having some issues.
http://mobile.tutsplus.com/tutorials/android/jar-for-android/
Clean your actionbarsherlock project. It will generate the .jar file for you when it re-builds.
Using the Android Tools option to Add compatible libraries fixed the problem for me.

Categories

Resources