I am completely new to Android Studio so it may sound a silly thing to an experienced person.
I am getting an error in Android Studio which states:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value
value=(25.3.1) from [com.android.support:design:25.3.1]
AndroidManifest.xml:27:9-31
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1]
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at
AndroidManifest.xml:25:5-27:34 to override.
I have Googled this and tried looking into it to solve it on my own, however, similar issues that I have found aren't quite the same errors.
I'm not experienced enough to understand and generate a fix for it although I understand some of it.
It may be the case that I need to provide more information for this so please let me know if so.
EDIT:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.g732d.appname"
>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".HomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Patients" />
<activity android:name=".NewPatient" />
<activity android:name=".StartActivity"></activity>
</application>
</manifest>
build.gradle (Project: appname):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module: App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.g732d.appname"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
}
SECOND EDIT:
Following the answer by Arefeh and the comment by Kunal, I changed the version mismatch by replacing compile 'com.android.support:design:25.3.1' with compile 'com.android.support:design:26.0.0-beta2'.
For this to work, I had to add maven { url "https://maven.google.com" } in the build.gradle (Project: appname) file within allprojects{} (have updated above to illustrate this).
Now I keep getting a render error which says failed to instantiate one or more classes. The classes are different for each activity depending on what I've used in the activity e.g.
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView
...
...
I guess the problem is for difference between versions of support libraries. Change your version of design library to 26 or higher.
compile 'com.android.support:design:26.+'
What seems to have worked in this instance, is going to File > Project Structure then in app > Properties where it says Compile Sdk Version and Build Tools Version, I changed them to API 25: Android 7.1.1 (Nougat) and 25.0.3 respectively. After which I synced the project and gradle and then rebuilt.
I then repeated the process and changed back again to API 26: Android 8.0 (O) and 26.0.0. So far it is working again although I will update if this changes.
Related
I'm trying to use MoPub using AdMob mediation. I've followed all instructions at https://developers.google.com/admob/android/mediation/mopub.
Currently I use facebook, applovin, inmobi through admob mediation and all of them work well. I integrated MoPub several times but it always says manifest not found. The problem is in step 3 https://developers.google.com/admob/android/mediation/mopub#step_3_import_the_mopub_sdk_and_adapter.
Note: I'm using androidX.
when testing I see this. I used admob mediation test suite and found like this.
Here is my app-level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion '30.0.1'
defaultConfig {
applicationId 'com.theaccidentalmedico.sociology'
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'MissingTranslation'
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
jcenter()
maven {
url "https://s3.amazonaws.com/moat-sdk-builds"}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
implementation 'com.google.ads.mediation:facebook:5.9.0.0'
implementation 'com.google.ads.mediation:mopub:5.13.1.0'
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation 'com.google.ads.mediation:applovin:9.13.0.0'
implementation 'com.google.android.ads:mediation-test-suite:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.13'
}
Here is my project level build.gradle.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm using AndroidX. Here is my gradle.properties file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
In admob implementation guide no instruction is given to edit androidmanifest.xml file. Here's my androidmanifest.xml 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="com.theaccidentalmedico.sociology">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:networkSecurityConfig="#xml/network_security_config"
android:icon="#mipmap/ic_launcher_foreground"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppThemeDefault"
tools:targetApi="n">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8803330956819211~8267554096"/>
<activity
android:name="com.theaccidentalmedico.sociology.MainTabActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:windowSoftInputMode="adjustPan|adjustResize"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theaccidentalmedico.sociology.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize" />
<activity
android:name="com.theaccidentalmedico.sociology.MeaningActivity"
android:label="#string/title_meaning_activity" />
<activity android:name="com.theaccidentalmedico.sociology.FavoriteActivity" />
<activity android:name="com.theaccidentalmedico.sociology.SettingActivity" />
<activity android:name="com.theaccidentalmedico.sociology.HistoryActivity"/>
</application>
</manifest>
SOLVED
This problem with Mopub was because of mediation test suite 1.3.0.
Solution:
Go to you app-level build.gradle and change mediation test suite version to 1.4.0.
That solves the problem.
https://groups.google.com/g/google-admob-ads-sdk/c/NGMX-2P-sAM/m/v32f4uEhAAAJ
Add to AndroidManifest.xml
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.RewardedMraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.privacy.ConsentDialogActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm trying to implement my first sceneform application.
I'm following the following tutorials:
My references:
https://www.youtube.com/playlist?list=PLsOU6EOcj51cEDYpCLK_bzo4qtjOwDWfW
https://developers.google.com/ar/develop/java/quickstart
I'm using the following configurations:
mac os High Sierra - Version 10.13.6 (17G7024)
Android Studio - 3.1.3
My app's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myfirstapp.example.com.helloar"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Provides ArFragment, and other UX resources.
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.11.0'
implementation 'com.google.ar:core:1.11.0'
// Alternatively, use ArSceneView without the UX dependency.
implementation 'com.google.ar.sceneform:core:1.11.0'
}
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
My project's gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.ar.sceneform:plugin:1.11.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myfirstapp.example.com.helloar">
<uses-permission android:name="android.permission.CAMERA" />
<!-- "AR Required" apps must declare minSdkVersion ≥ 24 -->
<uses-sdk android:minSdkVersion="24" />
<!-- Indicates that the app requires ARCore ("AR Required"). Ensures the app is
visible only in the Google Play Store on devices that support ARCore.
-->
<uses-feature android:name="android.hardware.camera.ar" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
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>
<meta-data android:name="com.google.ar.core" android:value="required" />
</application>
</manifest>
When I right clicked on .obj file and clicked on import sceneform asset. It's throwing the adding the following to my app's gradle file
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
Error Given:
Unable to find method 'com.android.build.gradle.api.ApplicationVariant.getMergeResourcesProvider()Lorg/gradle/api/tasks/TaskProvider;'.
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Kindly help with the fix.
I've upgraded my android studio to 3.4.2 and it's working now.
I'm having issues including Google services in my project.
The errors
Following these instructions, and also referring to the docs to set it up, I encounter a problem with the apply plugins property:
For reasons unbeknownst to me, it's not fetching correctly (something about the version being wrong) even though that property is auto-filled when you click on 'Add FCM to your app' (in purple). And as you can see, it doesn't have any version numbers in the URL.
I also encounter a problem with the implementation 'com.google.firebase:firebase-messaging:17.1.0' property.
I'll add in my manifest and gradle files for reference:
AndroidManifest.xml
<?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="com.nationscompanies.uordermobile">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:fullBackupContent="#xml/backup_descriptor">
<activity
android:name=".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>
<service
android:name=".MyAndroidFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyAndroidFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nationscompanies.uordermobile"
minSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.google.android.gms:play-services-gcm:15.0.1'
api 'com.google.firebase:firebase-core:16.0.1'
api 'com.google.firebase:firebase-messaging:17.1.0'
}
apply plugin: 'com.google.gms.google-services' // this is the line that gets autofilled when you click on the 'Add FCM to your app' button from Firebase manager
Full error message
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.1.
And then a giant list of errors:
Change this:
classpath 'com.google.gms:google-services:3.1.1'
into this:
classpath 'com.google.gms:google-services:4.0.2'
to prevent from getting the version conflict error.
Check here for more info:
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Beginning with version 15 of all Play services and Firebase libraries, each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time.
In order to support this change in versioning, the Play services Gradle plugin has been updated to 3.0.0(which is the first version).
I am not sure why this is happening, but I did some digging and tried to find other solutions. None worked out especially duplicate questions:
android {
compileSdkVersion 26
buildToolsVersion "23.0.3"
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':react-native-customized-image-picker')
compile project(':react-native-vector-icons')
compile project(':react-native-restart')
compile project(':react-native-image-picker')
compile project(':react-native-fast-image')
compile project(':lottie-react-native')
compile project(':react-native-fetch-blob')
compile "com.android.support:multidex:1.0.1"
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.fresco:fresco:1.0.1"
compile "com.facebook.fresco:animated-gif:1.0.1"
compile("com.facebook.react:react-native:0.54.0") { force = true } // From node_modules
}
I deleted some duplicate compiles that I found and still no help. I noticed in the trace this warning:
C:\ReactProjects\myapp\android\app\src\main\AndroidManifest.xml:11:5-29:19 Warning:
application#android:theme was tagged at AndroidManifest.xml:11 to replace other declarations but no other declaration present
C:\ReactProjects\myapp\android\app\src\main\AndroidManifest.xml:16:9-19:35 Warning:
meta-data#com.bumptech.glide.integration.okhttp.OkHttpGlideModule was tagged at AndroidManifest.xml:16 to remove other declarations but no other declaration present
I don't know if that will cause this whole thing to fail. Lastly here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="true"
tools:replace="android:theme"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Every problem that I had when trying to get a successful build I looked on SO or other sources, but this one takes the cake. I never inserted compile "com.android.support:multidex:1.0.1" before and it worked before this problem occurred. Still no success.
The last thing I remembered doing is saving a file called 'safecode.js' in the home directory and basically it just has code that I want to save.
I had the exact same problem and I understand what a headache this can be. Here was my solution:
1) Make sure there are no duplicate dependencies in build.gradle and settings.gradle
2) Most of you might not like this one, but I (hurts to type this) upgraded most things such as:
compileSdkVersion 26 - build.gradle
buildToolsVersion "26.0.1" - build.gradle
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip - settings.gradle
classpath 'com.android.tools.build:gradle:3.1.0' - build.gradle not in app directory
NOTE: Your Command Prompt's build UI will change and it does look overwhelming, but pretty cool. You'll get used to it. Also, you might need to change those compile in build.gradle soon.
Here is the solution for that: Android Studio build.gradle warning message
That should be pretty much it, but I'll also tell you other things I did that might affect your BUILD FAILED:
1) You might need Java 8. JDK 1.8. Add this to build.gradle app directory:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2) Get rid of compile "com.android.support:multidex:1.0.1"
3) targetSdkVersion 22 update to 26
And lastly,
4) In build.gradle not in app directory, put maven { url 'https://maven.google.com' } in both repos.
NOTE: You could use google() in place of that, but it didn't work for me so I stuck with maven { url 'https://maven.google.com' }.
ALSO TO NOTE: You might get messages saying, "WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.". Hey, 26 seems to be our magic number, if it works, then don't touch it. Unless you are absolutely certain you need to.
To my knowledge and experience the warnings you get from the build process won't affect your BUILD SUCCESS or BUILD FAILED.
I hope this works for everyone!
I have an error with my app in Android studio:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I use Gradle and Kotlin.
Android Studio 3.0.1.
Windows 10 Pro 64.
I have research this theme on SO and I have tried some solution from here, like that:
Clean and rebuild project. No changes.
Change 'compile' in gradle to 'implementation'. No changes.
Delete .gradle and build directories. No changes.
Add multiDexEnabled true in defaultConfig in gradle. In this case, I have another error:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [G:\work\myapp\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\Public\.gradle\caches\transforms-1\files-1.1\support-core-utils-27.0.2.aar\e1c9881d763269b67bf59dc03d19c305\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [classes.jar:android/support/v4/content/PermissionChecker$PermissionResult.class]))
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
multiDexEnabled true
applicationId "myapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
applicationIdSuffix ".dev"
}
staging {
debuggable true
applicationIdSuffix ".sta"
}
preproduction {
applicationIdSuffix ".pre"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.basecamp:turbolinks:1.0.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// The Client SDK resides on jCenter
implementation 'com.twilio:client-android:1.2.21'
}
My AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tunnll.passenger">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
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>
<service android:name="com.twilio.client.TwilioClientService"
android:exported="false" android:stopWithTask="true"/>
</application>
What am I missing?
UPD
It seems I found out the point after that the problem has appeared. It was after adding Twilio configuration. I used this manual: Twilio and Android
This is all changes that have been done:
Add to build.gradle:
implementation 'com.twilio:client-android:1.2.21'
Add to AndroidManifest:
<service android:name="com.twilio.client.TwilioClientService"
android:exported="false" android:stopWithTask="true"/>
Add to proguard-rules.pro
# Twilio Client
-keep class com.twilio.** { *; }
# Apache HttpClient
-dontwarn org.apache.http.**
That's all. Before this changes I didn't have this error
Use this in your build.gradle in app Module if you want to read an .aar file
for your libs dir:
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')
}
But it seems that your problem is multidex(means that you have more than 65K methods in your project so use this:
android {
defaultConfig {
multiDexEnabled true
}
}
and if your minSdk < 20 then use this as well:
compile 'com.android.support:multidex:1.0.1'
Hope it helps!!!