I'm a beginner and I use Android Studio. A problem keeps on bothers me.
It keeps on showing "Cannot Resolve symbol 'R' " everywhere with R.XXX.XXX
I've tried:
1.checking my xml files, including manifest
2.checking SDK whether Build Tools is installed
3.clean project
4.rebuild project
5.sync project with Gradle files
6.every way I could find on Internet
while rebuilding project the message shows "manifest merger failed with multiple errors, see logs"
I briefly paste a part of my activity here:
public class Clock_mainpage extends Activity {
private Button button_start;
private static final int START_LOCATION = 1;
private Item item;
private void findButton()
{
button_start = (Button) findViewById(R.id.start);
}
private Button.OnClickListener startclock = new Button.OnClickListener()
{
@Override
public void onClick(View view)
{
Intent intentMap = new Intent(Clock_mainpage.this, MapsActivity.class);
intentMap.putExtra("lat", item.getLatitude());
intentMap.putExtra("lng",item.getLongitude());
intentMap.putExtra("title",item.getTitle());
intentMap.putExtra("datetime",item.getLocaleDatetime());
startActivityForResult(intentMap, START_LOCATION);
finish();
}
};
Seems it appears to be something wrong in my Manifest.xml I post it below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hackntu.android.clock"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" />
<activity
android:name=".Clock_mainpage"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Google Service edition -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- Google Map API key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key" />
<!-- Map component -->
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps" />
<activity/>
<application/>
</manifest>
Well, this problem seems to be simple to every of you. But I wasted 3hours or more on it. Appreciate to all of you. Sincerely
You didn't past the most important think in such problem with R a imports. Problem is known and simple. For sure you had problem with some resources. R class was not generated. You get info from IDE that R can not be found and IDE propose you quick fix: import R class.
But because your R was not generated at that point and IDE has only android.R avaliable. IDE impot android.R
Please double check imports. In import you should have:
yourpackage.R
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras