xml - R cannot be resolved to a variable using Android Studio and Google Maps -


i aware there must problem somewhere in manifest or xml cannot find it. appreciated! i've spent while trying figure can't anywhere it.

error:element type "activity" must followed either attribute specifications, ">" or "/>". (i cannot see anywhere tags problem)

<manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.clubnightsdeals"     android:versioncode="1"     android:versionname="1.0" >   <permission         android:name="info.androidhive.googlemapsv2.permission.maps_receive"         android:protectionlevel="signature" />     <uses-sdk         android:minsdkversion="12"         android:targetsdkversion="18" />     <uses-permission android:name="android.permission.access_network_state" />     <uses-permission android:name="android.permission.internet" />     <uses-permission   android:name="com.google.android.providers.gsf.permission.read_gservices" />     <uses-permission android:name="android.permission.write_external_storage" />      <!-- required show current location -->     <uses-permission android:name="android.permission.access_coarse_location" />     <uses-permission android:name="android.permission.access_fine_location" />      <!-- required opengl es 2.0. maps v2 -->     <uses-feature         android:glesversion="0x00020000"         android:required="true" />       <application         android:icon="@drawable/ic_launcher"         android:label="@string/app_name" >         <activity             android:label="@string/clubnightsdeals"             android:name=".appactivity" >             <intent-filter >                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>        <uses-library         android:name="com.google.android.maps" />         <activity             android:label="@string/clubnightsdeals"             android:name=".app2activity" >         </activity>          <meta-data      android:name="com.google.android.maps.v2.api_key"      android:value="aizasydetfyqnfornvtrlybuvfht3rikxkt6dry" />           <activity             android:name="info.androidhive.googlemapsv2.mainactivity"             android:label="@string/app_name"             android:theme="@style/appbasetheme"/>             <intent-filter>                 <action android:name="android.intent.action.main" />                   <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>     </application>  </manifest>   

mainactivity

package com.example.clubnightsdeals;

import android.app.activity; import android.content.context; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.toast;  import com.google.android.gms.r; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment;       public class appactivity extends activity {      button button;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);     //  addlisteneronbutton();s     }      public void addlisteneronbutton() {          final context context = this;          button = (button) findviewbyid(r.id.button1);          button.setonclicklistener(new onclicklistener() {              public void onclick(view arg0) {                  intent intent = new intent(getapplicationcontext(), activity.class);                 startactivity(intent);                 }           });      };         public void addlisteneronbuttonnews() {          final context context = this;          button = (button) findviewbyid(r.id.button9);          button.setonclicklistener(new onclicklistener() {              @override             public void onclick(view arg0) {                  intent intent = new intent(getapplicationcontext(), app2activity.class);                 startactivity(intent);                 }         });          }          ;           protected void oncreate11(bundle savedinstancestate) {                 super.oncreate(savedinstancestate);                 setcontentview(r.layout.main2);             }            //google map          googlemap googlemap;          protected void oncreate1(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.main2);              try {                 // loading map                 initilizemap();              } catch (exception e) {                 e.printstacktrace();             }          }           /**          * function load map. if map not created create          * */          private void initilizemap() {             if (googlemap == null) {                 googlemap = ((mapfragment) getfragmentmanager().findfragmentbyid(                         r.id.map)).getmap();                  // check if map created or not                 if (googlemap == null) {                     toast.maketext(getapplicationcontext(),                             "sorry! unable create maps", toast.length_short)                             .show();                 }             }         }          @override         protected void onresume() {              super.onresume();             initilizemap();         }  

main.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/linearlayout1"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >      <textview         android:id="@+id/textview1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="club deals"         android:textappearance="?android:attr/textappearancelarge" />      <button         android:id="@+id/button1"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="gps locations" />     <button         android:id="@+id/button2"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="closest deals"         android:onclick="open_close_deals" />      <button         android:id="@+id/button6"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="cheapest deals"         android:onclick="open_cheap_deals" />       <button         android:id="@+id/button7"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="best value deals"         android:onclick="best_value" />      <button         android:id="@+id/button8"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="best events"         android:onclick="best_events" />      <button         android:id="@+id/button9"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="news"          android:onclick="news"/> </linearlayout> 

main2.xml

    <fragment         android:id="@+id/map"         android:name="com.google.android.gms.maps.mapfragment"         android:layout_width="match_parent"         android:layout_height="match_parent"/> 

the errors getting r cannot found , keeps suggesting import wrong version of r.

edit: have changed manifest

  

<activity             android:name="info.androidhive.googlemapsv2.mainactivity"             android:label="@string/app_name"             android:theme="@style/appbasetheme"             <intent-filter>                 <action android:name="android.intent.action.main" />                   <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>  

but still errors

the problem youre importing

import com.google.android.gms.r; 

solution: remove r.java used not google one..


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -