where to find r.java in android studio in latest version - android

I'm reading a book in that book they say I can find R.java file in some sort of path but I go thought the path they said I can't find the file and I think in latest version of android studio looks like they changed it , so now where I can find the r.java file

The R file is a generated class. The easiest way to find it is opening any activity you like say the MainActivity which comes in by default
You will have something like this in the onCreate function
public void onCreate(Bundle bundle){
setContentView(R.layout.activity_main):
}
In this method you can find the R class. To know what's actually inside it you can hover your mouse pointer over the R and then Ctrl + Click( Win, Linux) or Cmd + Click (mac) it to get to the definition

Related

Android studio hides R class

I was searching about R class in my project to get look on it without editing it.
When I press ctrl and click on R Android studio opens the resourse file instead of R class
Where does it exist in my project structure?
This is not about understanding R class in Android, It is about finding it the project for just having look inside it.
You can find R class by searching it with "shift + cmd + o" or "double shift".
I guess new android studio update directs to the xml source of the resource.
Please check in this path "app\build\intermediates\incremental-verifier\debug\your.package"

How to generate javadocs for android project

I followed all the instruction given on stackflow, but unfortunately not able to generate doc file for my android project.
If I am not mentioning class path on last step of java doc generation, then getting "Android reference" error.
And if using it, then getting "javadoc: error - The -classpath option may be specified no more than once." error.
Using classpath:
-classpath "D:\Android 4.2 SDK\android_sdk\platforms\android-15\android.jar"
Am I using correct class path command ?
Please help me out.
Environment used:
Eclipse indigo
If you use Intellij IDEA go to Tools - Generate JavaDoc... Specify all the settings and set params: -bootclasspath [path]\android-sdk\platforms\android-{version}\android.jar -encoding UTF-8 -docencoding utf-8 -charset utf-8
More information is in this post.
Have You followed these steps (from www.mtholyoke.edu)? This works on my Project....if not and You get an error, please write here which error You get.
Project -> Generate Javadoc
In the "Javadoc command" field - browse to find javadoc.exe
• On the computers in the Clapp CS lab that is C:\JBuilderX\jdk1.4\bin\javadoc.exe
• On other computers it would be \bin\javadoc.exe
Check the box next to the project/package/file for which you are creating the javadoc
In the "Destination" field browse to find the desired destination (for example, the root directory of the current project).
Leave everything else as it is.
Click "Finish"
Javadoc should be in the destination folder. Open "index.html"
EDIT
I found a thread here in Stackoverflow with a lot of tipps, try this:
Javadoc in Eclipse failing to recognize packages
NEXT EDIT
It is only a possibility, but You specified Your classpath as:
"D:\Android 4.2 SDK\android_sdk\platforms\android-15\android.jar"
I know that eclipse got some problems with spaces inside a path. So the first part "Android 4.2 SDK" has to be specified without spaces, maybe here is the issue. But be aware, if You change this path, You have to set everywhere the new path where You have definded it.
I'm using the command line. I have also updated to Eclipse Kepler. It seems to execute javadoc differently? I'm investigating. But try this:
read the javadoc manual. It's confusing and doesn't tell you what to do, but, here's an example that should get you going.
Create a file called "options"
Add to the file this:
-d target-bin
-stylesheetfile style.css
-use
-splitindex
-windowtitle 'My Project Name Class Specification'
-doctitle 'My Project Name Class Specification'
-header '<b>My Project Name</b><br><font size="-1">0.1.5-alpha</font>'
-bottom 'Copyright 2014 My Company or Myself. All rights reserved.'
-group "Group Of Packages" "com.mypackage.*"
-overview overview.html
-exclude 'android'
-subpackages 'com.mypackage:android'
-charset utf-8
-encoding UTF8
-quiet
-sourcepath ../myProject/src;..\..\..\android-sdks\sources\android-19
Then on the command line type:
javadoc #options
Now, in Kepler, the "Generate Javadoc" dialog box says "What is the javadoc command line"...I suspect I'll have to type something like this. But don't know.
Hopefully this quick example will give you a start on how to get it done for your purposes.
By the way, I created a generic Eclipse project called "javadoc" in my Workspace so I could manage the files.

Android Virtual Device location error

I'm having a problem with starting an AVD from Eclipse.
When I start the AVD that I just created, it gives me the following error:
I think that is because of the username in the path...
I tried to just copy the .android to C:\ (=C:\.android) but the manager is just searching in the old path...
I tried to setup a environement variable like this:
Name: ANDROID_SDK_HOME
Value: C:\Users\André Peixoto\.android\.android
But it didn't solve the problem...
What should I try next?
UPDATE
I reinstalled the android sdk and now it doesn't show the weird characters:
But the path for the AVD_2_3_3.ini file still wrong. I think it should be: C:\Users\André Peixoto\.android\avd\AVD_2_3_3.ini instead of C:\Users\André Peixoto\.android\.android\.android/avd/AVD_2_3_3.ini
How should I change that?
I solved that using the solution presented on the comment 26 from here:
No matter your configuration. If the message will be like this
"[2011-11-21 22:31:24 - Emulator] PANIC: Could not open AVD config file: C:\Users\Ярослав.android\avd\my_defult_android_2_3_3_avd.avd/config.ini"
(
"C:\Users\Ярослав.android\avd\my_defult_android_2_3_3_avd.avd"
- it's your AVD device configuration. )
than :
copy direcoty "my_defult_android_2_3_3_avd.avd" to some place where the path will not contain "Ярослав" symbols (I in result had
the path like this
"d:\android\my_avd_devices\avd\my_defult_android_2_3_3_avd.avd").
File "my_defult_android_2_3_3_avd.ini" will contained in directory "C:\Users\Ярослав.android\avd\". Open this file.
Change "path=C:\Users\Ярослав.android\avd\my_defult_android_2_3_3_avd.avd" to
"path=d:\android\my_avd_devices\avd\my_defult_android_2_3_3_avd.avd"
Save and close. Start your application again))).
But at the first time I tried this solution and it didn't work. So I uninstalled the android SDK and eclipse and reinstalled all over again. I also removed the environments variables for android_sdk that I had previously set and set a new one called ANDROID_HOME with value C:\android-sdk.
Now I'm able to run AVD.
I think this is not a ideal solution because each time I create an AVD, I need to do this process. But for now it solves my problem.
Hope this solution helps someone else.
UPDATE - New Solution
I was having some problems with the previous solution so I used a diferent approach:
I created a new account (Administrator) in my Windows which the username havn't accents.
I put my Eclipse folder inside C:\ to have access from the new account.
Now, when I want to work with Android, I change to this new account.

Cannot compile system app (Phone) using maven - EventLogTags cannot be resolved

this is related to my previous question. I'm trying to build Phone application from android 4.0.4 using maven (I'm adding framework_intermediates as dependency, so internal apis problems are solved), and I ran into this problem. Some parts of the logs are as follows:
Phone/src/com/android/phone/CallNotifier.java:[601,32] cannot find symbol
symbol : variable EventLogTags
(the corresponding line in CallNotifier.java is: EventLog.writeEvent(EventLogTags.PHONE_UI_MULTIPLE_QUERY); )
Phone/src/com/android/phone/InCallScreen.java:[723,28] cannot find symbol
symbol : variable EventLogTags
(the corresponding line in InCallScreen.java is: EventLog.writeEvent(EventLogTags.PHONE_UI_ENTER); )
So... it cannot find the class EventLogTags. There is actually a file Phone/src/com/android/phone/EventLogTags.logtags which has the following contents:
# See system/core/logcat/event.logtags for a description of the format of this file.
option java_package com.android.phone;
70301 phone_ui_enter
70302 phone_ui_exit
70303 phone_ui_button_click (text|3)
70304 phone_ui_ringer_query_elapsed
70305 phone_ui_multiple_query
Apparently, this file tells the system to use some particular tags to log important events in the system. I did a full grep, but could not find any file which defines the values PHONE_UI_ENTER, PHONE_UI_MULTIPLE_QUERY, etc. These are just logs, so I could just comment out these and get it working. But I don't want to do this because I need to build this inside the entire aosp later on. So my question is, how do I get this to compile using maven, without modifying any file?
The Android build system code-generates a Java class out of .logtags files if needed. See: https://github.com/android/platform_build/blob/master/core/base_rules.mk
You will need to decipher the make rules and run that code generation yourself, I imagine.

Error i R.java: "Syntax error on token 'int', VariableDeclaratorId expected after this token"

This morning when I opened up Eclipse to work on an Android project I got an error inside the R.java file.
I know what the error is, but I can't seem to grasp how to fix it ;\
The code where the error is:
public static final class string {
public static final int =0x7f040010;
public static final int app_name=0x7f040000;
As you can see, the first field doesn't have a name and that gives an error of course.
Problem is when I delete the file and it's auto generated again, the error is still there.
If I try to manually change or delete the field it doesn't help. Still an error.
Tried to restart Eclipse - no difference. Tried to clean up the project and I've tried to "fix project properties" from the Android tools menu.
Anyone? It's really annoying as I can't continue with my project. I might have to delete the project and copy the classes, xml and drawables, but I'd rather not - hate doing cumbersome work :S
The problem is most likely with the strings.xml file. When you build the project that file is compiled into the R.java resources class. So check your strings.xml file carefully and as there is most likely an issue there that is causing this compilation error.
Most probably, u have an empty string in your strings.xml
<string name=""></string>

Categories

Resources