android.app.ActionBar class not being recognized - android

The problem i'm facing right now is Android Studio doesn't recognize import classes api level 11 and above. And in manifest the minsdk version i'm using is 14, this is fustrating. I'm trying to import android.app.ActionBar but i can't, i was going to use support library but there's no sense if i'm using api level 14.
Thanks.

I resolved it modyfing the build.gradle in the section {android,defaultConfig} :-)

Related

android.app.DialogFragment not found

My android project supports a minimum api of 4.0. I should be able to use android.app.DialogFragment, but when I type in "DialogFragment" the only import available is from the support library. (I'm using AndroidStudio 0.8.14.)
If I try and add the import manually its not recognized as expected. I have the SDKs for 4.0 and above installed. Any ideas what I'm missing?
Did you change the API level minimum 11 in the Android_Manifest.xml?
You have to change it in this file.
In Android_Manifest.xml,
<uses-sdk android:minSdkVersion="**11**"
android:targetSdkVersion="integer" (above 11 or equal 11)
android:maxSdkVersion="integer" /> (above 11 or equal 11)
Could be possible problem.

Renderscript via the support library

Seems to me that android has an android.support.v8 package that contains Renderscript support. The thing is, this doesn't seem documented anywhere - the support library docs don't say anything about a v8 package, just v4 and v13.
Is that package supported on all devices with API level 8 and above and can it be safely used in production?
Its not yet production quality.
My Android tools contain the files:
./build-tools/18.1.0/renderscript/lib/renderscript-v8.jar
./build-tools/18.1.1/renderscript/lib/renderscript-v8.jar
Putting them in the libs/ directory of your project will result in a working build in Eclipse and with ant.
PSA for Googlers: RenderScript is now part of the Android Support Library. You can use it on Android 2.2+.
I have eclipse, android sdk tools 22.6.3, android platform tools 19.0.1 and I set both of these projects API 19 android 4.4.2.
I was able to compile and run hellocompute(from the samples of android 19) and wants to change it to android support v8 things.
following steps works for me:
1.set android build target to 4.4.2 api 19.
2.add "rendersrcipt-v8.jar" to libraries in android build path
3.in project.properties set things like
"target=android-19
renderscript.target=19
renderscript.support.mode=true
sdk.buildtools=19.0.3"
4.Comment out the following import lines:
import android.renderscript.RenderScript;
import android.renderscript.Allocation;
and import
import android.support.v8.renderscript.*;
5.clean the project and rebuild.

ActionBarSherlock Beginners Setup Error

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.

The import android.nfc.INfcSecureElement cannot be resolved

I got some sample code for android.nfc.NfcSecureElement but it throws some error.
The import android.nfc.INfcSecureElement cannot be resolved
Any suggestion how I can overcome this. Thanks.
The NFC API was added in API level 9, so ensure that your project utilizes the level 9 platform in your Project => Android => Project Build Target.

Android - Fragment API for API level < 11

I have came across a problem for dynamic forms in my app, which is suited for Android 2.1 and above. I know there is new Fragment API since API level 11 (Android 3.0 Honeycomb), but also I have read an article - http://android-developers.blogspot.com/2011/03/fragments-for-all.html stating Fragment Api is available also for API level lower then 11 in, so called, Compatiblity package. I have installed it via SDK, but I am not able to use is in my App, e.g. I cannot import android.app.FragmentManager, application doesn't know it.
Do you know, how to solve it? Is Fragment API truely available for older API levels? If so, how to make them going? Or is there any other solution like Fragments API? I will need for dynamic generated forms if possible
Thanks
Hmyzak
Android Studio:
Add a dependency for support compatibility package v4:
dependencies {
...
compile 'com.android.support:support-v4:21.0.+'
...
}
and then use import android.support.v4.app.Fragment; instead of import android.app.Fragment; in imports.
You need to add the package to the build path.
Use ActionBarSherlock. It comes with a lot of working examples.

Categories

Resources