java - 'cannot resolve symbol R' android studio error -
execution failed task :app:mergedebugresources
. error , how fix it?
<uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.internet" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <!-- attention: auto-generated add google play services project app indexing. see https://g.co/appindexing/androidstudio more information. --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application>
this xml above... , below oncreate()
setcontentview(r.layout.activity_main)
causing problem:
cannot resolve symbol r
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); locationmanager = (locationmanager) getsystemservice(context.location_service); provider = locationmanager.getbestprovider(new criteria(), false); // attention: auto-generated implement app indexing api. // see https://g.co/appindexing/androidstudio more information. client = new googleapiclient.builder(this).addapi(appindex.api).build(); }
'cannot resolve symbol r' error occurs , 'symbol r' turns red in color whenever gradle sync not completed. hence before running project advisable first sync project if dependencies or have been added , clean project , run it.
it should solve problem.
Comments
Post a Comment