Issue in accessing R. resources in Android 2.2 - java

I am very new to Android application development.
I successfully added some backgrounds to several layouts. And added media files to play. However when I rename a file in the folder structure, it shows an error that the resource does not exist.
But I can see those files in gen-><mypackage>->R.java->drawable.
Now my background pictures and resources do not appear in code.
R.layout.splashforproduct1 it shows an error for splashforproduct1.
not only splashforproduct1 but this issue is the same for R.raw.media.mp4
This is not first time I have got this issues. Please help me.
I am using Android 2.2 with eclipse.

If cleaning your project doesn't work try this: Scroll up to the top of the file and delete the import lines. Then wait for Eclipse to detect your changes and let it work out what you need to import and accept its suggestions.

I guess you just need to clean your project.
In Eclipse you do it clicking:
Project -> Clean and then you choose your android project.

Related

Android java class/symbol not found despite being placed in the same directory

I have encountered issues in my android studio regarding java classes/symbols not found, despite these classes and symbols being placed in the same directory, or under the same parent directory. I am making use of the DJI's mobile SDK for android.
Example of errors:
Cannot resolve symbol 'DJISampleApplication'
For illustration, here are 2 screenshots
First example. Clicking on "import class" causes android studio to create a brand new class instead of linking it to the existing one.
second example
However, oddly, when I go under "Build >> Make Project" , or "Run" to deploy on a real android device, the app can be installed, and there are no errors (only warnings).
Things I have tried:
Uninstalling and re-installing android studio
copying the whole project from the original files in again
Trying on another computer, which works. However, as i am only assigned this pc, i have to get this to work here as well.
Thank you in advance !
Your best bet is to invalidate caches and restart. Solves 99% of problems like this for me.
You can also try to reimport the project using the gradle tool window ...
Click the reload button here ...

what happend ? when i try to import my project from eclipse to Android Studio,it just can't run correct?

Now, i have problem that in the AndroidMenifest.xml, all of classes is wrong. And in Studio the APP can run , but is just flash past . before import to Android Studio, in the Eclipse , it' runs right . Anyone has an idea what's going on?
I really appreciate it .
In newer versions of Android Studio, the best way to bring in an Eclipse/ADT project is to import it directly into Android Studio; we used to recommend you export it from Eclipse to Gradle first, but we haven't been updating ADT often enough to keep pace with Android Studio.
In any event, if you choose "Import Project" from the File menu or from the Welcome screen when you launch Android Studio, it should take you through a specialized wizard that will prompt you that it intends to copy the files into a new directory structure instead of importing them in-place, and it will offer to fix up some common things like converting dependencies into Maven-style includes and such.
It doesn't seem like you're getting this specialized flow. I think it may not be recognizing your imported project as an ADT project, and it's defaulting to the old built-into-IntelliJ behavior which doesn't know about Gradle. To get the specialized import working, the following must be true:
The root directory of the project you import must have an AndroidManifest.xml file.
Either:
The root directory must contain the .project and .classpath files from Eclipse
or
The root directoy must contain res and src directories.
If your project is complex, perhaps you're not pointing it as the root directory it wants to see for the import to succeed.
Thank you.

Eclipse Will Not Generate R.Java In Linux

as stated in the title. I can not get Eclipse to generate an R.java file. It fails immediately after the creation of the project. I have read around and fixes have been stated as such:
Clean Project
fix android project
make sure all res/ files are lower case
make sure xml files are clean and no errors
make sure Build Tools is installed
Well I have tried everything for 3 days now and i can't get anything to work. I have even gone as far as marking every file in my android-sdk as "executable". Nothing works for me. Mind you I have never had this problem on my windows 7 machine. I am fairly new to android development.
I have attached images. First one is a screen shot showing that I do have all build tools and up Second is a Screen shot showing the errors and directory tree within my project. As you can see the only errors output are those that point to R.Java File
edit: I can't upload images so I have provided links to the screenshots within my Google Drive
https://drive.google.com/folderview?id=0B73rHBl5RuotOTUtQURfUTdveW8&usp=sharing
This looks like a duplicate for this one:
"R cannot be resolved to a variable"?
It has been extensively responded.

R.java is missing on a clean Android Project

I'm creating a clean project on ADT and I noticed that the gen folder is empty (with no R.java in it), not letting me run the project. I'm running ADT with all stuff up-to-date (as you can see here)
I already cleaned and built it in every possible way. I also tried to reimport the project, and nothing. There are no errors in the XML files.
I searched for a solution and I found a lot of people with the same problem, and in most cases the solution was to update the SDK tools, but it didn't work for me.
Is there a reason for this?
at the top of screen, click build -> rebuild project
Give it a few seconds. it worked for me, i hope it save you aswell
im using Android Studio(beta) 0.8.9
My R disappeared after i fiddled with sound files in my res/raw directory(converted them to different formats, figuring out how SoundPool class works...and suddenly there is red "R"'s everywhere!
Try right clicking on the project, then going to Android Tools > Fix Project Properties.
If that doesn't work, then try cleaning it before and possibly after that.
If R.java disappears, you usually have to recreate the project from scratch again.
There are many reasons for R.java missing issue, i use to face this issue frequently, some of my thoughts to debug this issue.
Try creating another test project using File->New->Project->Android->Android Application Project. After creating the project run the project in emulator. If every thing works then your setup is perfect.
Check your imports section of your java files, some times default R.java gets included which is from android package. In this case Remove that import and add correct import statement.
Check your "res" folder all the xml's should be well formed and valid.
Hope these debugging steps may help to find the root cause.
try deleting the r.java file in gen folder. when you run again after cleaning and building the project. It should recreate those files and it should work after that. Try that.
Other wise you might have to reinstall Eclipse as you have tried in so many different projects
Something I just noticed was that after I removed the auto-generated code for the menus (which I wasn't using) it started causing errors. Eventually when I cleaned with the menu xml's still in the file structure, my R file disappeared. I removed all entries in the menu folder and then cleaned again. This worked for my specific instance. Hope this helps others as well.

How can I modify the DroidGap.class file from phonegap-1.0.0.jar archive in eclipse?

I am really very new on android development.
I have made 2-3 apps , those running on my android device already.
Last few days I am facing a stupid problem.
The problem is , creating the app fullscreen for every device. I have read phone gaps wiki
and tried with specific way. But I failed everytime.
When I'm trying to open the DroidGap.class from my Android eclipse project explorer , I got a error. that, "DroidGap.class has no source attached". (after build the phonegap.jar)
Please help me....
first you need to add phonegap.jar to your project
you need to add phone gap plugin to your eclipse
Use the AppLaud Eclipse Plugin for PhoneGap Android
Download and unzip the PhoneGap sources from GitHub
In the AppLaud wizard, select "Enter path to installed PhoneGap"
Enter the directory path to the unzipped sources from GitHub
Now you will be able to modify and debug the sources that comprise phonegap.jar
Caveat: I'm the creator of the AppLaud Plugin
fullscreen?
If you want modify DroidGap.class dowload source code from github and rebuild phonegap.
Rebulid instruction here: https://github.com/callback/callback-android/blob/master/README.md

Categories