I\'m following a tutorial in HeadFirst Android development and encountered issues after adding: private ActionBarDrawerToggle drawerToggle;
The control was depre
Add <meta-data> tag in manifest.xml file as below...
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.demo"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
**<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="25.3.1" />//this 25.3.1 version should be same which we defined in the build.gradle file. i am using compileSdkVersion 25**
</application>
</manifest>
it will work @Ambilpura....
Whenever you face this issue, the best approach is to run Rebuild Project
- this will tell you exactly why this is happening.
In my case it was a meta-data
present in both module
and app
the answer by @sagar giri is a temporary work around. what i did to solve this is explained at the end.
If you have latest support library installed in latest android studio and if you have a old support library version in build gradle's app module, then android studio fails due to the version mismatch.
So update your support library version to latest one and fix latest support library changes like icon renaming etc and rebuild it.
hope it helps...
Problem is that all support libraries with same version and major version has to match compile SDK version.
So try to force a specific support library version.
Put this at the end of your app module in build.gradle
.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
First add this line to your manifest tag if you do not have yet:
xmlns:tools="http://schemas.android.com/tools"
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.winanainc"
android:versionCode="3"
android:versionName="1.2"
xmlns:tools="http://schemas.android.com/tools">
Then Add this meta tag inside your application to overwrite you build tools version, in this case for example I choosed the version 25.3.1
<application>
...
..
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="25.3.1" />
</application>