I am new to Android Studio .
When I create a new project with Blank Activity , the application runs fine on my handset.
However when I create a new project with Navigation Drawer Activity , the application doesn't work and shows me the following:
1- Wherever R
is located in the MainActivity.java
, it is red-colored with the following message:
Cannot resolved symbol 'R'
2- In the Messages Gradle Build tab:
Error:Execution failed for task ':app:processDebugManifest'.
Error: [C:\\ ...\\app\\build\\intermediates\\exploded-aar\\com.android.support\\support-v4\\24.1.1\\AndroidManifest.xml:21] Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
Here is my AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hwc.mst.mobilesharingtool" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.hwc.mst.mobilesharingtool.MainActivity"
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>
</manifest>
Here is what I did so far:
1- Build
-> Clean project
2- Tool
-> Android
-> Sync Project with Gradle Files
3- Check in File
-> Project Structure
-> app
-> Properties
(Tab) that:
(i) Compile Sdk Version = API 24: Android 7.0, and ..
(ii) Build Tools Version = 21.1.1
Step 1, 2 & 3 didn't change a thing and still unable to run the app !
How to proceed from here to fix this problem ?!
I couldn't figure out what was the problem exactly. So, I did the following:
Step(1) : Uninstalled Android-studio completely from my machine (following Harry James's instructions )
Step(2) : Download and installed Android Studio again
Step(3) : There is no step 3
Now, everything works fine.
PS: Big credit to @Aaron for the troubleshooting
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.