R.java File Deleted automatically

  • Replies:0
Mahi kalra
  • Forum posts: 1

May 28, 2015, 7:11:56 AM via Website

During my map implementation when complete code has been executed the R.java file automatically deleted and could not be regenerated. Through various posts on internet its given that perform changes on xml file and manifest file it automatically recreates itself. but nothing is happening to it. Plz help me out............This is my source code of activity class.

public class activity extends Activity {

private GoogleMap googlemap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
     try {
            // Loading map
            initilizeMap();

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * function to load map. If map is not created it will create it for you
     * */
    private void initilizeMap() {
        if (googlemap == null) {
            googlemap = ((MapFragment) getFragmentManager().findFragmentById(
                    R.id.map)).getMap();

            // check if map is created successfully or not
            if (googlemap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        initilizeMap();
    }`

manifest.xml

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

package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >

android:name="com.example.myapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature">

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="your service READ_GSF" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

 <meta-data 
     android:name="com.google.android.maps.v2.API_KEY"
     android:value="AIzaSyBxamsMr_b5gk3T14jNxnSy093L0iagozU"       
     />
    <activity
        android:name=".activity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Reply