I have seen this question asked multiple time on SO and went thru their answers thoroughly however, I am still struggling to resolve this problem.
As per multiple answers, I have ensured that maxSdkVersion in android manifest file is 23(I kept minSdkVersion to 15). I also put targetSdk in project.properties to 23. I am running project on android6 and have android-support-v4.jar included from androidsdk/android-sdk-macosx/extras/android/support/v7/appcompat/libs/android-support-v4.jar.
In android SDK manager, under extras, I have android support repository version 36(which I believe is the latest) and I am using android-sdk-tools 22.6.2
Can anyone please guide why this error still persist? How to remove it?
It was issue with obsolete jar from v7 appcompat. I used latest jar for android-support-v4.jar and it worked like a charm!!
Related
My imported project has errors importing common classes. For example in Context.java, the following lines (there are more in other classes) are in red and give the message "Cannot resolve symbol: 'lastPartOfThePackage'"(lastPartOfThePackage being AttrRes, IntDef, DisplayAdjustments, etc.):
Trying to solve the problem, I have tried everything I have read in other SO questions, but I keep getting the errors:
Invalidated cache and restarting.
Installed SDK Build Tools, SDK Tools, SDK Platform-Tools
Installed API 23 and API 16 SDKs (including the Google APIs)
Deleted .iml and idea folder and reimported the project
Cleaned, synced and rebuilded the project.
Deleted both "proguardFiles" lines from build.gradle
I also checked in my sdk folder for a annotations.jar file, and it's there.
What am I doing wrong? I have worked hard trying to solve it but I don't think I'm capable enough to fix it.
By default this should be included with appcompat, but try to add to your dependencies
compile 'com.android.support:support-annotations:23.1.0'
and sync Gradle.
biuld->clean project it would help.
That is because of #hide in android source code. Actually Android is not allowing developers to use some classes.
check your SDK API source code for #hide.
A solution is to use modified SDK which contains hidden classes. you can find it here https://github.com/anggrayudi/android-hidden-api
I have the latest Android Support Library, Android Support Repository and Google Repository (Rev. 23.1, 24, 22 respectively) and working with Eclipse Mars.1(4.5.1)
In the process of giving a make-over to an existing app, I am trying to import the v7.AppCompatActivity library, closing all other projects in workspace and silent prayers. ( ;-) )
Observations:
I daresay I have been unsuccessful even after following the instructions here to the dot.
Ian Lake's blog looks all hunky-dory, but Utopian.
Reading up tons of excellent answers on SO did not yet help. No matter what target is set in the project.properties page or what Build Target is set in the Eclipse Project Properties dialog - just cannot seem to get rid of this (and very similar) compile error(s):
android-support-v7-appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Going by the number of similar questions, I am surely not alone. Pray, can someone kindly throw some light on how to import the v7 support library without going insane?
Thanks in advance!
None of the answers or blogs pointed out the following, except #pkuszewski.
The above issue resolves on
upgrading to Android 6 Marshmallow API 6.0 with the SDK manager
setting the Build Target for the AppCompat project to Android 6.0
Did I hear, "Duh"? :)
Thanks, #pkuszewski!
SDK Manager fragment looks like this, post the fix:
This app I completed around a year ago (!) but never launched it on the market place. I am trying to open it up in eclipse now to make some small modifications and work on the code a little bit. So I imported it and then found this weird "unable to resolve target" error. It's highlighting every class red in all my 'src' files.
I've looked at a similar question which said to add the line to default.properties file. My project has a project.properties file which has the line:
target=android-7
Any advice how to get this to work? I could always start a new project and just copy all the src files but that would be pretty lame and time-wasting.
One more comment - I'm developing on a new computer and I don't think I have the API level 7. Could that be the problem? I've gone into Window --> Android SDK Manager and the oldest available API it shows is level 8. But level 7 will mean I can target more devices I think so I'd like to go with that.
Thank you for any help.
Well, yes that is your problem. You don't have the API level 7 downloaded. You can right click the project and go properties->android and select another available API. As long as you don't change the min sdk version in your manifest you are still targeting as many devices as before.
<uses-sdk android:minSdkVersion="7"/>
Update
You don't have to do this, but you can get the older APIs on the SDK Archives page
I don't know if there is any official source for the next statement but that is what I found while working. If anybody can complete this with a better answer I would appreciate it very much.
You can compile the code with a newer SDK version as long as you don't use any code not compatible to the previous ones.
Example:
I want my app to be available for API level 7. But i only have API level 15 installed. As long as I keep the minSdkVersion="7" in my Manifest and don't use any resource not available in the previous APIs the app will work just fine on my targeted devices.
For anyone who wants to test their project against an API level that isn't the most recent one, you can just use the SDK Manager to install the old SDK:
In Eclipse (with adt installed):
SDK Manager:
Just check the box of the SDK you want to use to test against your project and click install. You can also remove API's that you aren't using.
Right click on your project then:
Properties -> Android -> Project build target -> Check Android 4.1.2
In your application's manifest.xml file add this tag
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
It's worked for me. Try it.
I resolved this issue by editing my project.properties file
from: target=android-7
to: target=android-19.
I also changed the target sdk version in the manifest file:
android:targetSdkVersion="19".
Yes. I see the same problem when I import the android support v7 project as a library project in my own project,the eclipse says that cannot resolve android16, I find that it's the problem of the eclipse,you can right-click your project which has this problem,and then select properties,the Android pane,there is a Project Build Target pane there,you can see it easily,choose a standard android platform,like Android4.3,not others that start with Google API,I hope that this will help you!
check android:minSdkVersion= in the AndroidManifest.xml
update target=android- in the project.properties if you use Eclipse IDE
I am attempting to set up ActionBarShelock for the first time using Eclipse on Windows 7.
I followed these instructions: http://actionbarsherlock.com/usage.html
ActionBarSherlock project.properties:
android.library=true
# Project target.
target=android-15
ActionBarSherlock AndroidManifest.xml:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11"/>
My error in Lint: Call requires API level 11 (current min is 7): android.widget...
Or if I ignore the error on ActionBarSherlock and import it as a library then I cannot compile my project because any references to the library are not recognized and I get no resource errors.
I looked up many people with similar problems and it was always an API build target error. Thank you for your suggestions!
A few things:
Make sure you are compiling your application with Android 4.0 or newer (API 14+). You must do this in addition to just the library.
Ensure you are calling getSupportActionBar rather than getActionBar. This is likely the source of your errors for lint.
While targeting API 11 is valid, many things are gained by targeting 14 or higher. Try to do that if you can.
I found it! The JDK compliance level was set to 1.5. After setting it to 1.6 it worked.
It says this right in the Action Bar Sherlock website in the requirements section but I made the error of assuming Eclipse was using the latest JDK settings.
Definite beginners mistake.
Thank you for your help.
Are you using an old version of ActionBarSherlock perhaps? As the current version, 4.1.0 has the targetSdk set to 15.
I think some older version can have a problem with newer ADT/lint or similar.
I have been trying to get ActionBarSherlock ( http://www.actionbarsherlock.com ) working with my eclipse projects. I added ABS into a new project with target version 3.2, and this created fine. When I try to add this as a library to my other project (min version 2.1, target 3.2), I get errors such as
G:\EclipseWorkspace\Android\ActionBarSherlock2\res\values-v11\abs__styles.xml:65: error: Error: No resource found that matches the given name: attr 'android:windowActionModeOverlay'
basically, none of the xml attributes found in 3.0 or higher are recognised. As a consequence, R.java does not generate.
Am I doing anything wrong?
You need to compile with Android 3.2 in addition to targeting at least API 11 both in your app and for the library.
In eclipse, right click on the project and go to "Properties". Under the "Android" tab you'll need to select Android 3.2.
Eclipse is giving me strange Errors too, when implementing external libraries. What always helped for me after some tries:
try multiple times:
*rightclick on your project => Source => Clean Up
*delete and readd the library project
*restart eclipse several
you might also try to delete the generated files to force it to regenerate, but do this on your own risk :)
have fun w/ the open source libraries :)
Try upgrading the version of the sdk and target version 2.1:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
This will allow using last sdk features and the app will work on version 2.1.
Maybe, you'll see issues even after fixing this. Then you can clean the project.