I am trying to run the AnimationsDemo from the android developers website:
http://developer.android.com/training/animation/zoom.html
But I can't manage to compile it. I keep getting an error with the R.java file as it is not being generated. Hence, in all the Activity classes I get an error saying "R cannot be resolved into a variable).
I also have errors in the manifest file saying:
"error: No resource identifier found for attribute 'parentActivityName' in package
'android'"
It seems like it cannot find the any of the activity classes found in R.Layout. I did NOT import the "android.R" file so I know that's not the issue. I haven't really touched the code, so I can't figure out why it's complaining.
error: No resource identifier found for attribute 'parentActivityName' in package 'android'
This usually means that your build target (e.g., Project > Properties > Android in Eclipse) is set too low. Try raising it to a higher API level -- 14 or higher should work. You may need to download additional API levels through the SDK Manager depending upon what you have installed.
You need to update the xml layout file and the activity class. Also share common features like the bg, font, and scheme. Etc.
Related
I got some errors while trying to Make sample Bdsk file. As a novice to Android Studio I would appreciate very much to let me know how to fix these errors.
I use the sample source code according to this instruction:
To use the solution code, create a new Android Studio project using the name "Bdsk" and Company domain "bluetooth.com". When the project has been created, replace the contents of the folder Bdsk\app\src\main with the contents of the Bluetooth Developer Starter Kit folder "Android\Source\solution" (except for thie readme file).
No resource identifier found for attribute
Those errors are not with Bdsk. You are not compiling the Android Support Design Library.
Check your Gradle file for a dependency android.support.design. If there isn't a line with that, there's the problem
No resource identifier found for attribute 'layout_behavior' in package
You'll want to update the version number accordingly
I am trying to import this material-dialog library.
Getting this error: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog.Alert'.
Getting it in file: values-v21/styles.xml.
I am using Eclipse and I have imported android-support-v4.jar in libs folder. What could be the issue here?
In your project properties, make sure that you have selected API level 21 as your platform. Also, in your manifest file, make targetSdkVersion as 21. Then clean & rebuild your project, and it should work.
Whenever you use the new Material Design features or the newest version of the support library, the project needs to be compiled against API level 21.
As a reference for others running into this issue, make sure you've prefixed the name of the parent theme with android:, so the full parent tag will look like this:
parent="android:Theme.Material.Light.Dialog.Alert">
I was getting the same error because I copied some code the didn't include that prefix for some reason.
After I upgraded my android tools to latest version to work on API21, trying to compile my project resulted in the following error:
update_languages_button_preference_layout.xml:2: note: did you mean to use #+id instead of #+android:id?
update_languages_button_preference_layout.xml:2: error: creating resource for external package android: id/layout.
update_languages_button_preference_layout.xml:2: error: Error: No resource found that matches the given name (at 'id' with value '#+android:id/layout').
The problem seems to be the line android:id="#+android:id/layout": replacing #+android:id by #+id was enough to be able to compile and run the project normally.
However, a rapid search through the whole codebase revealed a few other locations in the project where the construction android:id="#+android:id/... is used. These apparently didn't prevent the project from passing all tests, even if I can't assure they are all still in use.
Is there any legitimate use of android:id="#+android:id that would justify leaving those references in our xml files, and not replacing them all by #+id?
Why didn't they raise the same error as the first file did?
No, you should never use #+android:id in your app. The android namespace is reserved for the framework. This has never been safe for an app to use and will now generate a compile error.
For a little background, generating new IDs within the android namespace will put them in the unused space after the existing android namespace IDs. This will work fine until new IDs are added in the framework, at which point your internal ID will overlap with an actual framework ID and cause weird issues.
As for the other instances, those should be generating errors as well. It's possible that there is a bug in AAPT. Regardless, you should remove all instances of #+android from your resources.
Though my comment is very late. I faced same issue today, when updated my eclipse and tools. Changed #+android:id to #+id and it solved my issue.
I am playing with the new google expansion pack stuff, and the google library project for the downloader has a special values-v9/styles.xml file for the notification text properties. This causes an error when the app that is using the library is preAPI9... at least for me. It is referring to some style stuff that only appeared in api9. I've tried setting
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="9" />
in the AndroidManifest.xml of the main app, but this didn't help. I would (naively) hope eclipse would just ignore the error if I'm building for api8, and then when deployed on the market the system would use the values-9 stuff if the phone were at or above that level, but it doesn't seem to work that way. So, I'm hoping I'm missing something trivial here.
btw - here are the specific errors
Description Resource Path Location Type
error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.StatusBar.EventContent.Title'. styles.xml /Google Play Downloader Library/res/values-v9 line 4 Android AAPT Problem
Description Resource Path Location Type
error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.StatusBar.EventContent.Title'. styles.xml /Google Play Downloader Library/res/values-v9 line 4 Android AAPT Problem
Yes, I'm getting this also. I posted a related question here:
Android apk expansion file libs problems
I'm stumped to know what to do.
Update:
This worked for me. I deleted the values-v9 folder and rebuilt everything. The DownloadManager is now working. How, I don't know.
Try changing build target via Project->Properties->Android AND/OR Clean your project via Project->clean...
This worked for me after having to manually create the styles.xml file inside the styles-v9 folder through windows explorer.
I've fixed this error by building the project with the following commands:
android update project -p . -t 3 --target android-10
ant release
The first command tells to use the Android 2.3.3 toolchain for buiding the project.
Note that I still have android:minSdkVersion="8" in AndroidManifest.xml.
You should not delete the values-v9/ folder. Removing it can cause displaying notification with dark font on dark background.
If you download the latest api version, you should be able to build the library project against that correctly.
At runtime, Android will discard any code that doesn't work with the api on the device (you'll see various log messages about this), and ignore any res folders with a too high version number. Watch out for the v11 notification code, however: it only works on v14 and above so you'll have to change the code which decides which notification to use.
In my app, I've got a menu which pops up when the user hits the "Menu" physical button. It's going mighty-fine except for the fact that Eclipse isn't recognizing one of the drawables that is built into the Android.jar package. If you look and see, "ic_menu_refresh" is built into the supplied Android.jar when you create an Android Project.
I'm using the following code to use the particular icon:
android:icon="#android:drawable/ic_menu_refresh"
Eclipse gives me an error stating the following:
error: Error: Resource is not public. (at 'icon' with value '#android:drawable/ic_menu_refresh').
menu.xml
/Yeousch/res/layout line 3
Android AAPT Problem
I can clearly see the resource but Eclipse seems to ignore it. Any solutions?
The compile error is informing you the resource you want is not public, not for applications to use.
According to http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html#examples9 applications should provide their own copies of these drawable resources.