Using Eclipse, I was using android:minSdkVersion="10", got the error message that this was too low, and updated it to 18. After cleaning the project, refreshing and building Android Environment, I still get the same error message!
In Properties -> Android -> Project Build Target, I have selected Android 4.4.2, with an API level of 19.
in AndroidManifest.xml:
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
ERROR:
"Call requires API level 17(current min is10):android.app.AlertDialog.Builder#setOnDismissListener"
How do I make sure my update in AndroidManifest really works?
Thanks in advance.
It has been a while since I've used Eclipse for Android development. If you're new to Android, I'd highly recommend that you check out Android Studio, instead.
Anyway, this sounds like a build issue. I'm imagining that you're using the default ant build script so in that case the most likely culprit is your project properties file.
Look for a file called "project.properties"
and add/modify a line to contain the following:
# Project target
target=android-18
It sounds like it's currently pointing to android-10. You can find more information on this file and others here.
Related
I am utilizing the library BaseGameUtils and google-play-services_lib. In the project.properties file I could see the below mentioned line .
target=android-19.
What is the significance of this? Can I change this to "target=android-21". This is just to be in sync with the App's manifest file
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
Yes. You can change this, Depending target only, packages load for you in eclipse.
What is the significance of target=android-19?
target = android-X in project properties file means that Eclipse will not allow use methods or classes from SDK higher than X. It will show compiler errors.
How to change target:
Right click your project.
Then click "Properties".
Then select "Android" from the tree on the left.
You can then select the target version on the right.
NOTE: Before doing this make sure your project.properties and classpath are not in read-only mode otherwise it won't work. Also don't try to edit this file manually.
As a general rule I use the following guidelines
android:minSdkVersion="8"
Set this to the minimum level you want to support. Check which Android version that it actually relates to and make sure that you have compatibility with that version. For example, I think 8 = Android 2.2, which could be a problem if you are using google play services libraries. It is good practice to at least test that you app will work properly on this version using the emulator, because otherwise you will get a lot of errors and bad reviews.
android:targetSdkVersion="21" />
I usually set this to the maximum version that I have actually tested my app on. I thin 21 is Android 4.4, so you should be making sure that your app works correctly on this version of Android. At the least, you should test that it will run in an emulator that is configured with this version of Android.
Hope this helps.
I just imported my old Android Project that I just checkout from my git repo.
When I try to create a new Master/Detail Flow Activity using Eclipse :
New > Android > Android Activity > Login Activity > Next
The Eclipse reports me error saying :
This template requires a minimum SDK version of at least 3,
and the current min version is 1
Where as my actual entries in my AndroidManifest.xml is :
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
Can someone tell me what am I missing here?
I am using Android SDK Tools of version 23.2 and Android SDK Platform-Tools version 19.0.1.
Looks like Eclipse does this when you refactor your code that affects entries in your AndroidManifest.xml.
So, before doing anything else Close your eclipse project from workspace and open the project again by double clicking it. This will force Eclipse to reinitialize your project and will also run Lint & Other checks.
If this doesn't work, try any of the above things suggested by other users.
I think this is a Lint rule triggered only by the current version of the tools (likely this is something that was added, of the severity was changed in the rule-set).
You can disable this rule in the Lint Perspective, or by right-clicking on it from the Android XML editor.
Not sure what the actual fix is (hopefully someone will answer) - this will silence it, so your build works (but you should really fix the original problem).
Check your Android manifest file. When this happened to me there were obvious errors in the file.
I am trying to implement the ActionBar in a Mono Android application. Could someone provide me steps to including the ActionBar project in my solution? I have seen the sample projected provided at this url
https://github.com/xamarin/monodroid-samples/tree/master/ActionBarSherlock
Do I have to simply add a reference of the ActionBarSherlock project in that sample? When I attempt to add a reference to that project I get many errors such as "Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Menu'." in file abs_styles.xml
Has anyone else successfully added ActionBarSherlock to a Mono Android Project? Could you please provide me steps to get a simple example working?
Ok, this is how I got it working...
Open up the sample project and build just the 'ActionBarSherlock' project on Release mode. Make sure that the minimum target android version is 4.0.3 (required)
Take the dll and reference it in your project. I have found that you can get it to compile fine if your project has a minimum android version of 2.2 - I found that if you used profile version 2.1 it doesn't work, but that just might of been my app. Maybe your minimum version is too low? I also set my 'target' android to be the latest... I don't know if this helps too.
The reason I say to reference the dll instead of the project is that you will get the correct intellisense. Otherwise as you can see in the example project it does not (Makes working on it a pain!).
Make sure you have a reference to the v4 support lib in your project (Mono.Android.Support.v4)
The final step is that need to change your default theme to use a Sherlock theme. (see xml below for example)
Use the ActionbarSherlock.* namespaces when adding Actionbars etc...
Example manifest after adding ActionbarSherlock:
<manifest ...>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
<application android:label="IDNT" android:theme="#style/Theme.Sherlock.Light.DarkActionBar" android:icon="#drawable/Icon">
</application>
</manifest>
BEWARE: There is a small issue with all this... If your project has a minimum version of under 3.0 (ie 2.2 as per my example) and you compile with linking (ie SDK assemblies only) you will get an error 'Mono.Cecil.ResolutionException: Failed to resolve Android.Database.IDatabaseErrorHandler'. I am currently sending support messages about this to Xamarin and will edit this post once I work out a fix.
EDIT: To fix the issue I have mentioned above make sure that the project options -> Application -> Minimum Android to target option is at LEAST 4.0.3. Your minSdkVersion can still be 7/8 or whatever so it will still run in older android versions. It also means you have to be careful you dont code in stuff that is for higher versions.
I am creating a project in android using eclipse.
Now my problem is when i create a android application project, I set Build Sdk version to 4.1 (API 16). But when i saw in manifest file the android:targetSdkVersion="15" . Can anyone explain me why this is happening ? see the below screenshots.
Thanks in advance
Updated Answer:
Here it goes,
Solution is,
goto:
Your
Directory\android-sdk-windows\tools\templates\projects\NewAndroidApplication\root
Open :
AndroidManifest.xml.ftl File
Change :
default :
<uses-sdk android:minSdkVersion="${minApi}"
android:targetSdkVersion="${targetApi}" />
Modified :
<uses-sdk android:minSdkVersion="${minApi}"
android:targetSdkVersion="${buildApi}" />
So the Problem goes here:
In the ftl file the attribute name ${targetApi} has been set, but we are selecting the buildApi value in the project creation window.
${targetApi} or ${buildApi} default value is the higher version , that means in your SDK tool it is API 15. So it is always 15 in the Manifest.
If you tried to create a new project with target API less than 10 or more than 15 anything , in the manifest it will be denoted as 15 only always.
Try this:
Create a project with API target 8 and see , manifest target will be 15 only. (Before modify the ftl file).
But project.properties has been updated properly.
So if you change ${targetApi} to ${buildApi} in the Manifest.xml.ftl, the problem solved.
It is a possible error in SDK tools revision 20, Even i updated the SDK tools itsn't resolved in the recent revision also.
Hope this one might be helpful for somebody, those who facing the same.
Older Answer:
It is showing for me too. But in my case, I selected API 14 and it is showing android:targetSdkVersion="15" in the manifest.
I guess some reason should be there... 4.0 or 4.2 , it is assigning 4.1 in the manifest... Or may be a bug with Eclipse IDE. Why cant you update the newer version of Eclipse IDE and try it out. This might be a IDE Problem only.
Can you see that Right click- Properties - Android , Checked one is same what you selected in the beginning.
And also project.properties has the same version what you selected in the beginning.
well the Project target you set is got set in the default.properties file if you change that and save it the the attached sdk will change you can try it.
the entry in menifiest is used after compilation on the device . don't know why it is taking wrong value.but in my eclipse it takes only minsdkversion and its value is same what i entered on start.however my point is it does not matter
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