Resource not found exception - android

I am trying to use datepicker in my project. But as soon as I run the project, it throws "Resource not found exception" and following line appears when I drag datepicker in xml file
The following classes could not be found:
- CalendarView (Change to android.widget.CalendarView, Fix Build Path, Edit XML)
- DatePicker (Change to android.widget.DatePicker, Fix Build Path, Edit XML)
logcat entries are as follows:
FATAL EXCEPTION:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dateandtimepick/com.example.dateandtimepick.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x16
How can I rectify the code. Thanks in advance.

android.content.res.Resources$NotFoundException: String resource ID #0x16
You are trying to set int value in
tetview.setText() or Toast.makeText(), which it will take as string resource id.
So try to give int value in like this
.setText(""+intvalue) or Toast.makeText(context,""+intvalue,..)

I solved the "Resource not found" exception by re-installing the Android SDK. For some reason, while packing the apk, the SDK tools weren't packing the resources. Its' a build error (silent error) that yells only at runtime. I did not need to reinsatll JDK or eclipse.

Try to clean to Project to rebuild the R.java
Rebuild the xml by creating a new xml,I guess maybe you forget to add the namespace (xmlns:android="http://schemas.android.com/apk/res/android")
Hope I can help.

Related

How do I fix Error: Duplicate id in Android Studio

I getting
Error:(7) Error: Duplicate id #+id/item, already defined earlier in
this layout [DuplicateIds]'
I'm using Android Studio. How can I fix it? Thanks in advance.
If you using text layout and check the xml code for finding the red line(indication of error) in android studio.
If you have than change the value like shown in the image and finally clean and build the project.
Error Image
After change the id
Maybe you had defined two view with the same id.Check your code.(ctrl+f)
It is not the as's fault.

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

R.Java id error

can some help me here??
i am getting error in following line of code in R.java file
public static final int login_user-fb=0x7f0d00bf;
the identifier "-" is creating problem as you all know.
i have not declared this id anywhere in my project, i am using facebook sdk in my project since than it is giving error.
things i have done to rectify the error till now.
1.removed facebook sdk and rebuilt projct.
2.clean project
3.as you know i cannot edit R.java file, i tried doing everything but every time it is creating that code in my R.java file as whenever i run my project.
please help me out here.
Could you please check through your xml-files, and see that you have the correct naming convention for all your id's etc.
I am thinking of these type of naming errors:
android:id="#+id/text-view-example"
and rename them to:
android:id="#+id/text_view_example"
OR
Search in your project by right-clicking on 'app', in your left side panel (android-view), and click on 'Find in Path', and then type in that exact query, login_user-fb, and then replace them to login_user_fb.

why am I getting the error "error executing aapt "

I'm getting the error executing aapt :return code 1073741819 due to which
.apk file is not generated how to fix this. How to fix if r.java file is missing
It could be a syntax or formatting error in one of the XML files. I just got this error code (it's actually negative), and I checked all the #string references and they were OK. Eventually I figured out it was because of this item in a menu XML file:
<item
android:id="#+id/action_stop"
android:orderInCategory="100"
android:icon="#drawable/ic_action_stop"
android:showAsAction="ifRoom | withText"
android:title="#string/action_stop"/>
However, the spaces around the | apparently aren't valid (XML isn't Java...). Eclipse didn't catch it as an error, but aapt crashed without giving a reason when it saw it. Not particularly graceful handling, by both Eclipse and aapt. Removing the extra spaces made everything work.
The problem with missing entries in strings.xml apparently produces error code -1073741816, not -1073741819. You have to look closely, but the last digit is different.
I'm not saying the problem is definitely some sort of syntax error. But it's another possibility that could be investigated.
I got this error when I had deleted a #string entry that was being referenced in a menu node xml resource.
I had this error and spent time trying to find a solution.
Finally the solution for this error which is: -1073741819 ( check the digits ) was a library was missing from: Properties -> Android -> Library
I just added the missing libraries and got this error resolved.
I got the same problem. What helped me was changing the Project Build Target
Properties->Android->Project Build Target

Content Provider Resources$NotFoundException

Created a profile using content provider. After running it correctly, added 3 fields to the table. But now its not working correctly.It shows an error like android.content.res.Resources$NotFoundException: String resource ID #0x4d2.Any solution?
If you are using Eclipse, try to do Project|Force Clean. If you are working outside of Eclipse, run ant clean. Your error message is probably because your resources, the generated R.java file, and some of your other compiled code are collectively out of sync.

Categories

Resources