Android Start New View Error: missing instrumentation.class - android

hey,
i have new activity that extends Activity and when i'm trying to change to her i'm getting the following error:
"the source attachment does not contain the source for the file instrumentation.class"
any ideas?

Apparently, this behavior is "normal". I found an answer to this question from a different forum.
That's normal. The SDK doesn't include source code for Android
classes. If you step into an Android class while debugging, you'll
get the "source not found" message. Do Run -> Step Return to finish
executing the method without source code.
However, when I try to Step Over or Step Return, I still receive this error and the program stops. So, I guess it's an answer, but not a solution. I don't know how to get passed this issue.
Here's a link to the original forum post
Update:
Using this link View Android Source Code in Eclipse, I found the solution I needed. Find the post by Volure in the comments section. It has a link to a packaged set of Android base code needed to overcome this issue. Put the zip file in the corresponding directory. Then in the Package Explorer, r-click on the jar file, select Properties. In the Java Source Attachment dialog, select External File. Select the zip file. Press OK. Again, r-click the jar file in Package Explorer and select refresh. Test the setup by double-clicking any of the Android classes. You should now see the source.
Hope this saves someone some time. It took me 4 hours of research to discover the solution.

Related

How to resolve android studio formatting error?

I'm sorry for the title of my question but that's the best title i could come up with....
It seems like my android studio project just got butchered from one day to the next. When i open some of my java file, i see nothing related to my code same thing with most of my xml files, but when i navigate to those files in my file explorer and open them same files with notepad i then see the correct content.A screen shot of one of my java files
And one of my xml files
This is a common problem in Android studio
Please follow this answer
https://stackoverflow.com/a/63027190/7793652

No "android resource directory" option on right clicking res folder

I'm an iOS developer, and I'm expanding my skill set by working through the recommended Udacity tutorials for Android development.
In the "Add a Menu" tutorial in "Developing Android Apps", in order to create a new XML file for menus, it states:
"right click the res directory, select 'Android Resource Directory'". This is followed by a number of other points to correctly set up a menu xml file.
On my system, when I right click on the res directory, I have no option for "Android Resource Directory". I've uploaded a screen grab of what I get:
compared to the tutorial:
I've tried just creating a standard directory, and then right clicking and making a new xml file within it, but it doesn't seem to be working, as the XML file won't even open when I double click on it. I'm guessing it also won't be setup correctly, and I'm not sure how to do that manually.
I also tried the "Resource Bundle" option, but it didn't seem to give similar options as to what the tutorial says is to be expected.
I've had a look in the Udacity forums, and didn't see anything there on this. They also didn't seem to be frequented much, so I thought asking here was a better idea.
I'm also guessing Gradle sync error is not causing this, I haven't looked into the cause of that yet, I think perhaps because of my Core2 processor...
My guess is it's to do with my newer version of Android Studio, but I've been unable to find any info on this.
Thanks for any pointers :)
Seems like your gradle project files are not synced properly. As it is in screenshot you shared. You need to make sure gradle syncs successful so android studio will provide those context menu options properly for specific directory
Here - Resource directory
Click on Build->Clean Project and then file-> sync project with gradle file
Try the menu New/Folder/Font folder

Source not found in class file editor

My eclipse is not showing description of any default classes.
It is showing:
Source not found.
The source attachment does not contain the source for the file GestureDetector.class
You can change the source attachment by clicking change attached source below
Please help me..
As the error say. Click on "Change attached source" (there should be a button) and specify the jar file or folder that does contain the source code for this class.
I assume, that you include some jar file that contains GestureDetector.class in your project. Per default, Eclipse looks into this jar for the source code. Thus, I assume the jar contains binary only. Thus, you need to get a different jar that contains binaries and source code. Or you need to download the source code from somewhere on the Internet (if available), store in at any location you like and then specify this folder as indicated at the beginning.
You have to attach the java documentation and if you already have, navigate to the folder and select it. If you dont have you either download or make. To make download Jdecompiler it will generate the source for you.
You can also take help of grepcode here

How do I open a .apk google example?

Ok so I want to learn android push notifications. I found at android to use the C2DM service.
http://code.google.com/android/c2dm/
Great they even give me an example. http://code.google.com/p/jumpnote/downloads/list
My problem is I don't know what to do with the file after I download it. :P
It is an .apk file. So how do I open it in eclipse to learn from it?
An apk is an android install app thingy you run it on your phone. To edit search android code examples and select the first one select what you want to edit dowbload the manifest and the other files and edit them in eclipse. Have you ever tried opening a .exe in notepad it does not work so well because it is already compiled same (i think) with the. Apk also make sure you have the android plugib for exlipse. Sorry for the strange language I am a delvoper who forgets the name of everything. And the grammer i am only 13.
Rename it to .zip and you can open it with your favorite zip unarchiving program.

Finding out where a file in the project explorer is used in the code in Eclipse IDE

I am developing android applications using Eclipse IDE.
Now, I have given someone else's code to modify.
I need to check where a particular drawable/image in the res/drawable folder is used in the code or in the xml (res/layout). Also I need to find where I a particular xml (res/layout file) is used in the code.
Is there any short-cut to find out these things or I need to go through each & every line of code to find out these things ?
Please help.
#Ankit
For First Thing for checking a particular drawable/image in the res/drawable folder if you want to find that whether image resource is used in project or not for that you have to search like this in Eclipse For Example Your image name is bg.png so you can search like this using Ctrl+h in your Project Explorer than when search window Open you will find one File Search tab than write this in search box #drawable/bg than you will get Match Result.
For Second Thing Now use Same Ctrl+h than write this R.layout.yourlayoutname in search box than if this layout is used in your android project than you will get result for that.

Categories

Resources