1

1.When Iam Importing an existing project or creating a new project displaying an error : R cannot be resolved to a variable, after importing R seems it is unable to access the xml layout files tries fixing this issue

        http://stackoverflow.com/questions/5143369/main-cannot-be-resolved-or-is-not-a-field

2.At the same time on ANOTHER MACHINE while running my application ".apk file" is getting created but unble to reflect the output on the emulator

      [2012-10-04 15:24:29 - HelloAndroid] Android Launch!
[2012-10-04 15:24:29 - HelloAndroid] adb is running normally.
[2012-10-04 15:24:29 - HelloAndroid] No Launcher activity found!
[2012-10-04 15:24:29 - HelloAndroid] The launch will only sync the application package on the device!
[2012-10-04 15:24:29 - HelloAndroid] Performing sync
[2012-10-04 15:24:29 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'android2.1'
[2012-10-04 15:24:29 - HelloAndroid] Launching a new emulator with Virtual Device 'android2.1'
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] Failed to create Context 0x3005
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] could not get wglGetExtensionsStringARB
[2012-10-04 15:24:37 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
[2012-10-04 15:24:37 - Emulator] emulator: warning: opening audio input failed
[2012-10-04 15:24:37 - Emulator]

Home Screen->

package com.example.new_xyz_fertilizer;

import android.app.Activity;
import android.os.Bundle;


public class Home extends Activity {

    public void onCreate(Bundle HomeBundle){
        super.onCreate(HomeBundle);
        setContentView(R.layout.home);

    }


}

and in xml layout file --> home.xml

?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:background="@drawable/BG01"
    >


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:gravity="bottom"
        >
        <ImageView
            android:id="@+id/home"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/home_s"/>
        <ImageView
            android:id="@+id/nc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/nc_s"
            />
        <ImageView
            android:id="@+id/locncon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/locncon_s"
           />
        <ImageView
            android:id="@+id/ft"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ft_s"
            />

          <ImageView
            android:id="@+id/csf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/csf_s"
            />
    </LinearLayout>



</LinearLayout>       


Thanks in advance
Shweta
  • 807
  • 3
  • 11
  • 24
  • It looks like there might be something wrong with the emulator you are trying to launch. Have you tried launching the emulator directly from the AVD Manager? – CocoNess Oct 04 '12 at 07:14
  • Yes, rather than running the application.. First I launched the emulator from AVD followed with running the app by selecting the launched emulator..Still getting the same error. – Shweta Oct 04 '12 at 07:18

1 Answers1

1

Importing R.java from other project might create a problem.

Try this: right click on the project -> Android Tools -> Fix Project Properties.

Than check if the problem is solved or not.

One more thing, as far as I know GPS will mostly work on the Physical Device and not on Emulator/Simulator.

Rishi
  • 330
  • 2
  • 13
  • Tried right click on the project -> Android Tools -> Fix Project Properties., but still facing the same issue.Also , iam not using GPS in my app – Shweta Oct 04 '12 at 07:15
  • Try: Project -> Build Automatically than Project -> Clean, and than Project -> Android Tools -> Fix Project Properties. Also don't forget to select Project -> Build Automatically. – Rishi Oct 04 '12 at 07:20
  • Its still showing an error..Is there any possibility that this might happen cos some of the libraries of eclipse or android might be missing ?? – Shweta Oct 04 '12 at 07:30
  • I don't think so, but you can try updating packages from Help -> Check for Updates from eclipse and than import your project. Also one more thing is if the project you are importing was created in the latest eclipse version and you are importing in the older eclipse version than it might create a problem. – Rishi Oct 04 '12 at 07:33
  • and what about the project you are importing? in which version it was created? – Rishi Oct 04 '12 at 07:58