Android Support Library causes unresolved R import - android

I'm working on an Eclipse Android project (target SDK 18). Since I wanted to use some Material Design features from Android 5 I added the library project Design Support Library (Target SDK 23) to Eclipse and linked it to my project. This project links to another library project called Android-support-v7-appcompat.
I get the following error: "The import [...].myProject.R cannot be resolved".
Whenever I remove the support library from my project the error disappears.
Since a lot of people had the same problem before I already tried rebuilding and cleaning the project a couple of times. I read this post and added the android-support-v7-appcompat.jar to my project. I delted the support v4 jar from the support-v7 libs folder. Then I followed this guide and made sure that the \res folders didn't contain any errors. Still no success. I hope someone can help me.

Related

resolving appcompat_v7 error

I am having a issue regarding the resolving of appcompat_v7...As mentioned on many answers i imported the jar file from the \sdk\extras\android\support\v7\appcompat\libs...
but the problem is under properties->android i am getting a red cross next to appcompat_v7
as mentioned on various answers i then clicked on add button here...but i get no library name
the library is installed as the import is working properly as can be seen here the import shows no error..but my style.xml file in the res folder is showing the following error
can somebody please tel me what i am doing wrong here..
also my SDK manager shows that my android support library is installed...
I am just new to android and cant figure out what I am doing wrong here..
You dont import jar's from the appcompact-v7 library. You import the library itself in your workspace. Then you add the library into your project. In your project you can remove the appcompact-v7 in red and add it again. That should solve the issue.
Note also that:
You must have the latest versions of SDK Tools / Build Tools / Platform Tools. If you try this and it doesn't work, then go to the Android SDK Manager and make sure you have the latest versions of the required tools.
In case your project only requires API level 14 (Ice Cream Sandwich) & above, select API level 14 for "minimum required SDK" in the project wizard when you create a new project. Now the appcompat_v7 library will not be required for this project, and the application will use the native ActionBar class which is present in AOSP builds from ICS onwards.

how do i add v7-appcompat library to my project?i have followed the steps on google developer site and its just importing v4 library

I am trying to add Support Library v7 to my clean android project as support library (with resources). I followed every instruction here: http://developer.android.com/tools/support-library/setup.html#download and android.support.v7.* package is not visible in my main project.
I don't see any errors in Problems tab, app compiles and runs normally but i cannot import android.support.v7 package which apparently isn't in build path in main project. I went through instruction twice in clean projects/workspace. I cleaned project, restarted Eclipse and nothing... All resources from library project are unreachable too.

Using holoeverywhere

I am trying to install holoeverywhere to ADT using instructions from
https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE#eclipse
Unfortunately this ends with:
No valid Android XML Editor Delegate found for file /HoloEverywhere
Addon
The POM for com.google.android:support-v4:jar:r13 is missing, no
dependency information available
And hundreds of other similar errors. I tried it several times from scratch, doesn't help. I suspect installation steps changed again... Is anyone able to help?
I just successfully installed HoloEverywhere on ADT, and this is what I did:
Part I
Import the project from git following this instructions (for protocol use git)
This will create four new projects in your package explorer: HoloEverywhere Addon Preferences, HoloEverywhere Addon Slider, HoloEverywhere Demo and HoloEverywhere Library. Leave open just the last one.
remove HoloEverywhere/ActionBarSherlock/actionbarsherlock/libs/android-support-v4.jar
Copy HoloEverywhere/library/libs/android-support-v4-r13.1.jar to
HoloEverywhere/ActionBarSherlock/actionbarsherlock/libs/
on Eclipse mark the Holoeverywhere Library project as Android library(is Library).
Part II
File->import->Existing Android Code into Workspace. Import "HoloEverywhere/ActionBarSherlock/actionbarsherlock/".
Now you have actionbarsherlock as a new project in your Package Explorer
On Eclipse mark this project as Android library(is Library).
On HoloEverywhere Library project Android properties add actionbarsherlock as library.
Part III
On your Android project properties add "HoloEveryWhere Library" project as library.
Part IV
Enjoy!
The project holoeverywhere developers sometimes change project instructions, locations, etc. for better adaptting to platforms like eclipse.
You may have all possible problems as other people do, so in github there are lot of fixes and answers. Here is the link:
HoloEverywhere issues

ERROR: "._android-support-v4.jar" in project FacebookSDK

Help needed!!!! Stuck for 2 weeks on this and help needed.
I've recently imported the facebook sdk for android and its projects into my workspace. It shows up errors and the problems:
Archive for required library: '/home/Documents/facebook-android-sdk-3.0.2.b/facebook/libs/._android-support-v4.jar' in project 'FacebookSDK' cannot be read or is not a valid ZIP file
And the samples get errors along the line of:
The container 'Android Dependencies' references non existing library '/home/Documents/facebook-android-sdk-3.0.2.b/facebook/bin/facebooksdk.jar'
The things I have done following the other discussions without any success are
cleaned project
set the Facebook SDK as library
looked at the build path section and added external jar consisting of facebook/libs
imported fb sdk like 20 times and into different folders.
made sure my java compiler was 1.6
HELP would be very greatly appreciated!!!!
Take the lastest version of android-support-v4.jar (in your sdk environement : sdk/extras/android/support/v4/android-support-v4.jar) and replace in your project and library project do not create conflict.
The steps to importing a library are:
Download the library
Place the library in the libs folder of the project.
Build the project
Do Not attempt to import the library using some import wizard.
I suspect either your download was corrupted, and you need to do it again, or you put the file into the wrong directly.
I think your problem is that the android.support.v4 versions are different, take the one from your project and replace the one in the Facebook sdk lib folder, it should dismiss the clash.
As per your question, I think you are not able to compile once you add the SDK to your project. Do you get an error saying unable to run as library?
If so that means you have included this as library and create your project as a library to be used further. It is a common mistake that I have seen many people do when they try to import a library to use and tick mark the checkbox is Library. This actually means you want this project to be treated as a library for future use. Just try to add the SDK and do not tick mark the checkbox and this project will run fine.
Many forums will just tell you to tick that checkbox and you will be stuck on this error for long time.
For any .jar file related issues you have to make the .jars files compatible as there hashing a problem and the two jars are not compatible with each other (a version issue).

Use of ActionBarSherlock library get error "R class can not be resolved"

I am using ActionBarSherlock to implement action bar for Android 2.1 platform.
But in Eclipse, no matter I import existing project from download ActionBarSherlock library or create new project from the download library, I always get error of "R can not be resolved". Then I notice that there is no R.java file under gen/ folder. I tried to clean the project, but it does not help... Anyone can help me on how to get rid of this ActionBarSherlock library?
ActionBarSherlock (v3.x) requires that you compile with Android 3.2. The reason you are not seeing an R.java file is that you are likely using a previous version for compilation which means some of the styles that are used on Android 3.0+ cannot be found.
Make sure you are building with Android 3.2, target API 11+ in your manifest, and are using JDK 1.6. Those are the common pitfalls with compilation of the library.

Categories

Resources