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.
Related
I am getting error as
Type error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml /res/values line 7 Android AAPT Problem
I have created the android app using settings in Android JUNO:
Min Req SDK: API 8,
Target SDK: API 21,
Compile With: API 25,
Theme: Holo Light with Dark Action Bar (Also tried with None),
Create Activity: checked,
Create Activity: Blank Activity (Also tried Empty Activity),
I have also tried upgrading Android Support Library from Android sdk, but did not help.
When I tried to import, AppCompat is not present anywhere.
Also when I tried to Add Library from Project Properties, there is no AppCompat available there.
Please help me with detailed explanation or let me know if any more details are needed.
I have solved this one by downloading Android Studio and while installing I have selected "Do not import anything from previous installation". There may be problem with my previous installation with Eclipse Juno.
I Hope this will help someone looking for an answer.
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 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.
I have to use 2 ANEs in my android project.
When I attach 2nd ANE Flash Builder shows a lot of such problems:
Error occurred while packaging the application:
aapt tool failed:C:\Users\***\res\layout\anesample.xml:8: error: Error: No resource found that matches the given name (at 'text' with value '#string/cnn').
All of them are with #string problem.
All strings are present and in the res\values\strings.xml.
Both ANEs work well in another project but I could not find a difference between this projects.
What's wrong?
ANEs work fine together fhen I recompiled one of them with different name of strings.xml, i.e. srings-fb.xml.
But you can imagine situation when every ANE library is compiled not by yourself…
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.