I updated the Android Studio to version 3.1 and the Gradle for my Project to version 3.1.0. Since then I had some problems related to merging multiple files, but that I was able to solve. Then I had this error:
> Manifest merger failed :
Attribute activity#com.aware.ui.PermissionsHandler@launchMode
value=(singleTop) from [com.awareframework:aware-core:4.0.555]
AndroidManifest.xml:35:13-43 is also present at
[com.github.denzilferreira:aware-client:4.0.555]
AndroidManifest.xml:44:13-42 value=(standard).
Suggestion: add 'tools:replace="android:launchMode"' to <activity>
element at AndroidManifest.xml:30:9-37:66 to override.
So, first I tried to use tools:replace="android:launchMode"
inside the mentioned Activity:
<activity android:name=".MainActivity"
...
tools:replace="android:launchMode"
android:launchMode="standard">
</activity>
But it did not solve the problem, then I searched and found some similar questions and their responses.
One of them said to delete the proposed attribute from the libraries that were conflicting:
<activity
android:name="com.aware.ui.PermissionsHandler"
android:configChanges="keyboardHidden|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleTop" //deleted this line from Manifests
android:noHistory="true"
android:theme="@style/Theme.AppCompat.Translucent" />
But again, with no success. I also tried to use tools:replace="android:launchMode"
inside the application tag:
<application
...
tools:replace="android:launchMode">
An then use the android:launchMode="standard"
inside the activity tag.
<activity android:name=".MainActivity"
....
android:launchMode="standard">
</activity>
But it throws a different error:
tools:replace specified at line:16 for attribute android:launchMode,
but no new value specified
I also tried to reorder the dependencies inside the Gradle files, like @GLee answered here but it did not make any difference.
This is one of the libraries I'm using that is conflicting: Aware Activity Recognition Plugin.
And this is the tutorial I used to create the application: Creating a standalone application.
Another relevant thing to say is that the two dependencies conflicting are in different modules, the com.awareframework:aware-core:4.0.555
dependency is inside the app module and the com.github.denzilferreira:aware-client:4.0.555
is inside the activity_recognition module.
Finally, this is my App Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "app.miti.com.iot_reduce_daily_stress_application"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
...
}
dependencies {
...
implementation "com.awareframework:aware-core:${aware_libs}"
implementation "com.android.support:appcompat-v7:${support_libs}"
implementation "com.android.support:cardview-v7:${support_libs}"
implementation "com.google.android.gms:play-services-location:${gms_libs}"
implementation "com.google.android.gms:play-services-maps:${gms_libs}"
implementation "com.google.android.gms:play-services-places:${gms_libs}"
implementation 'com.android.support:preference-v14:${support_libs}'
implementation "com.android.support:design:${support_libs}"
implementation 'pub.devrel:easypermissions:1.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "com.google.firebase:firebase-core:${firebase_libs}"
implementation "com.google.firebase:firebase-messaging:${firebase_libs}"
...
}
And this is my activity_recognition module Gradle file:
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 27
versionCode version_code
versionName version_readable
multiDexEnabled true
}
...
}
dependencies {
...
implementation "com.google.android.gms:play-services-location:${google_libs}"
implementation "com.android.support:appcompat-v7:${support_libs}"
api "com.github.denzilferreira:aware-client:${aware_libs}"
implementation "com.koushikdutta.ion:ion:2.1.6"
implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2"
}
This is the App AndroidManifest.xml (error URL directs to this file):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="app.miti.com.iot_reduce_daily_stress_application">
... //permissions
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="android.support.multidex.MultiDexApplication">
<activity android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".MainActivity"
tools:ignore="UnusedAttribute">
</activity>
</application>
</manifest>
Since this is not a dependencies version problem, like many other questions I found, and because I have to use this library dependencies in my Project, how can I solve this problem?
P.S: I have already tried the usual methods:
- Invalidate Caches/Restart
- Deleted Gradle
- Clean Project and Rebuild Project
- ...