Failed to resolve: multidex-instrumentation - android

Whilst implementing multidex I'm encountering the following error whenever I sync my project.
Failed to resolve: multidex-instrumentation
I used these instructions to set it up.
Here is the relevant app-level build.gradle:
android {
compileSdkVersion 28
defaultConfig {
applicationId "xxx.xyz.zzz"
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled true
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
....and the rest
}
And the relevant project-level build.gradle:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
What am I missing here?

Add the below dependency in you gradle file and check. I was facing the same issue and by adding this it resolved the issue.
androidTestImplementation 'com.android.support:multidex-instrumentation:1.0.3'

solved for me just by moving google() after the maven repository for google in all projects repositories in the project build.gradle file
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven{url "https://maven.google.com"}
google()
}
}

React-native + rnn v2 got stuck with same problem sollution: If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:
android {
defaultConfig {
// ...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true }
// ...
}
// ...
}
However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library as follows: then follow the official instructions here https://developer.android.com/studio/build/multidex

Related

Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom'

i tried everything i could think of but i keep getting this error.
this is my gradle build:
buildscript {
repositories {
jcenter()
maven{ url "https://dl.bintray.com/android/android-tools" }
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath 'com.google.gms.google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven{url 'https://www.google.com/'}
maven { url "https://dl.bintray.com/android/android-tools" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.textbookexhange"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
my gradle wrapper is fine
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
The reason you are not able to resolve the version 4.0 because the version 4.0 is not available in the JCenter.
https://jcenter.bintray.com/com/android/tools/build/gradle/
Firstly the version 4.0 should be available in your Bintray package in order for it to mirror in the JCenter You can check the same in the below bintray download link:
https://dl.bintray.com/android/android-tools/com/android/tools/build/gradle/
Update the version 4.0 under the path "com/android/tools/build/gradle" in your bintray package so that it will be reflected in the JCenter.

Android Gradle error while importing old project

I am importing one project which was created by another person a long time ago. And when I import I get these errors which I resolved but now I am stuck with this below error while syncing app Gradle file which I don't know how to resolve.
My build.gradle (app module)
buildscript {
repositories {
maven {
url 'http://repo1.maven.org/maven2'
}
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
repositories {
maven {
url 'https://github.com/donnfelker/mvn-repo/raw/master/'
}
maven {
url 'https://jitpack.io'
}
mavenLocal()
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "in.co.blab"
minSdkVersion 14
targetSdkVersion 22
versionCode 8
versionName "1.5"
multiDexEnabled true
resConfigs "en"
resConfigs "nodpi", "hdpi", "xhdpi", "xxhdpi"
}
}
What shall i do.
below is error
Error:Execution failed for task ':app:processDevDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
First, you need to change compileSdkVersion, buildToolsVersion, targetSdkVersion to same version. Change them to version 25:
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "in.co.blab"
minSdkVersion 14
targetSdkVersion 25
...
}
}
In case you're using Android Studio >= 3.0, change you build gradle tools to version 3.0.1 (you better move this to your project build.gradle):
buildscript {
repositories {
maven {
url 'http://repo1.maven.org/maven2'
}
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
and update your gradle inside gradle-wrapper.properties to gradle-4.1-all.zip.
Last, move the following line to the end of your app build.gradle:
apply plugin: 'com.google.gms.google-services'

Failed to resolve: com.android.support:appcompat-v7:27.+, How to solve this permanently?

This problem can be solve by including maven repositories as answered :Failed to resolve
But we need to add maven repositories every time after creation of new project, so is there any other way to fix this permanently?
Make sure added the new repo in root gradle.build
repositories {
maven {
url 'https://maven.google.com'
}
}
You may also use with newer gradle wrapper:
repositories {
maven {
google()
}
}
If you have used data binding in repo, then make sure you have added:
android {
....
dataBinding {
enabled = true
}
}
This is the best way to do it.
In your root level gradle.build use below
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
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 {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and in your gradle-wrapper.properties file change the wrapper version as below
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
Also in your app level build.gradle make sure you are using 26 version as below:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
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'
}
}
}
If you want to fix this permanently, you should add following codes in init.gradle (for more info about init.gradle, please check this site : Initialization Scripts):
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead. (Android Studio 3.0)

I get below error when I had migrated to Android Studio 3.0 recently.
Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead.
I tried following the steps in:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html but still get the same error.
My build.gradle is as follows:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://maven.google.com' }
}
}
Module's build.gradle is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.example.rakesh"
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dataBinding {
enabled true
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
once having seen the actual build.gradle ...
you need to build with buildToolsVersion '26.0.2' (or later), which is the least required version - while there are no instructions, which would be directly related to the given error message. it's a little strange, that it does not complain about the buildToolsVersion mismatch, in the first place.
the buildscript part does not belong into there (removing that from the module's build.gradle might already be the remedy). also, delete the .gradle and all the build directories, before trying to build.
Make sure you added the new repo in root gradle.build:
repositories {
maven {
url 'https://maven.google.com'
}
}
You may also use with newer Gradle wrapper:
repositories {
maven {
google()
}
}
If you have used data binding in repo, then make sure you have added:
android {
....
dataBinding {
enabled = true
}
}
This is the best way to do it.
In your root level gradle.build use below
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and in your gradle-wrapper.properties file change the wrapper version as below
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
Also in your app level build.gradle make sure you are using 26 version as below:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
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'
}
}
}

Issue resolving gradle dependency in android studio?

I am trying to add a styled progress bar from https://android-arsenal.com/details/1/1375
There it says:
Add the specific repository to your build file:
repositories {
maven {
url "https://jitpack.io"
}
}
Add the dependency in your build file (do not forget to specify the correct qualifier, usually 'aar'):
dependencies {
compile 'com.github.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}
Well I did that...
build.gradle (Project)
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
build.gradle (Module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.chaz.simsirl"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.github.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}
Then in messages it says:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.akexorcist:Android-RoundCornerProgressBar:1.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
Required by:
SimsIRL:app:unspecified
You would need to add the jitpack repository in a different place:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Then it works
In your first snippet it was added under buildscript and it should be removed from there.
Try to replace your dependency with this:
compile 'com.akexorcist:RoundCornerProgressBar:1.0.0'
This package is available in jCenter.
Then you can remove this:
maven {
url "https://jitpack.io"
}
Reference: https://github.com/akexorcist/Android-RoundCornerProgressBar#download

Categories

Resources