Execution failed for task ':app:checkDebugAarMetadata' (Android Studio) - android

I am trying to test my integration for Facebook Audience Network bidding with Google Admob by using the mediation testing. I followed the steps provided by the Google Admob to setup the Mediation Test Suite, but I ended up getting the following error when Android studio trying to build the app:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.android:flexbox:1.1.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/android/flexbox/1.1.1/flexbox-1.1.1.pom
- https://repo.maven.apache.org/maven2/com/google/android/flexbox/1.1.1/flexbox-1.1.1.pom
Required by:
project :app > com.google.android.ads:mediation-test-suite:2.0.0
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I am really not sure what I am missing. I already add the implementation for the Mediation Suite properly in my manifest file, and also I added my App ID from Google Admob to manifest file too, and set up the testing device. But still get this error. Can anyone help me with this error? Thank you for your help!

Same problems with me this day, spend hours to remove that same errors.
I try this and its solved..!
Remove jcenter() from gradle project's from both allprojects and
buildscript, sync gradle.
Add again jcenter() in same places as removed before, sync again
Errors Gone !

try to change mavencenter() to jcenter() after mediation suits test work juste return to mavencenter()

Just adding some extra details for people trying to use the Mediation Test Suite from admob. (Especially if your getting the flexbox1.1.1 error issue)
Finer details always help. Here are all the steps needed to make it work::
1...Add your publisher ID from admob to your manifest:
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="YOUR_ADMOB_PUB_ID"/>
2...If you have previously removed jcenter() [because its deprecated] from build.gradle(Project) put it back into repositories.
repositories {
jcenter()
mavenCentral()
google()
}
3...Make sure android.useAndroidX=true & android.enableJetifier=true is in your gradle.properties.
android.useAndroidX=true
android.enableJetifier=true
4...Add the implementation to the build.gradle(Module)
implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
5...Change your debug options in build.gradle(Module) to prevent crashes. Add debuggable true & make sure minify and shrink are false.
debug {
debuggable true
minifyEnabled false
shrinkResources false
}
6...The code for Mediation Test Suite should be added after your ad system has initialized. Make sure the MobileAds.initialize(...) has completed eg.....
Activty tActivity = this;
MobileAds.initialize(tActivity, new OnInitializationCompleteListener() {
#Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
Map<String, AdapterStatus> statusMap = initializationStatus.getAdapterStatusMap();
for (String adapterClass : statusMap.keySet()) {
AdapterStatus status = statusMap.get(adapterClass);
Log.d("Mediation", String.format(
"Adapter name: %s, Description: %s, Latency: %d",
adapterClass, status.getDescription(), status.getLatency()));
}
loadGoogleBanner();
loadFullScreen();
tActivity.runOnUiThread(new Runnable() {
public void run() {
MediationTestSuite.launch(tActivity);
}
});
}
});
7...Resync. Clean & rebuild. Invalidate cache if necessary. Importantly! Do NOT import the flexbox?.?.? into implementations. jcenter() already knows where to find it.

Related

JCentre may be down permanently. What are our options?

I have been trying to build a react native app since the early hour of today but was getting the follwing errors:
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Read timed out
After checking out https://jcenter.bintray.com, I found out it was down. Can anyone point me to the right option to resolve this issue? Is there any alternative since they said the site may not come back up?
I guess your question is already answered here.
As mentioned in this source:
No more submissions will be accepted to JCenter since March 31st, 2021.
So you should migrate all of your repositories to the alternative hosts such as mavenCentral.
Based on the answered issue on Github, a temporary solution could be like the following:
android/build.gradle
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://jcenter.bintray.com/')) {
remove repo
}
}
}
if the issue came form node_modules you can use patck-package to keep the changes on production environment.
As stated in https://stackoverflow.com/a/74265617/772091 , dependencies can come with their own jcenter() repository. If you can wait for every dependency to be updated, you can force remove those repositories, using your android/app/build.gradle file :
allprojects {
repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://jcenter.bintray.com/')) {
remove repo
}
}
}
...
Reference links, [FIXED] Android build failures : https://github.com/facebook/react-native/issues/35210

Gradle build fails saying : Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3

I'm building a new project using Android Studio Canary and while setting up dependencies for jet pack compose I get this as build output:
Execution failed for task ':app:processDebugAndroidTestManifest'.
> Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3.
Required by:
project :app > androidx.compose.runtime:runtime:1.0.0-beta02
enter image description here
Add jcenter to the repositories of your settings.gradle file.
You can specify that it should only be used for this missing artefact.
It should look like this:
repositories {
google()
mavenCentral()
//noinspection JcenterRepositoryObsolete
jcenter {
content {
includeModule("org.jetbrains.kotlinx", "kotlinx-collections-immutable-jvm")
}
}
}
Try adding jcenter() to your repositories. It's being phased out and you'll get a warning, but at the moment it is the only solution. See this:
https://github.com/ReKotlin/ReKotlin/issues/47
and https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/ : "To clarify, the JCenter repository will keep serving packages for 12 months until February 1st 2022. Only the JCenter REST API and UI will be sunsetted on May 1st 2021."
Based on this thread, I get rid of jcenter from my Jetpack Compose project by:
Modify the dependencies.kt in BuildSrc to add
object Collections {
private const val version = "0.3.4"
const val immutable = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:$version"
}
Modify the build.gradle(Module:) to add
implementation Libs.Collections.immutable
Replace jcenter with mavenCentral from
build.gradle(Porject:)
build.gradle(Module:)
build.gradle.kts
As a workaround, you could add explicitly to force the dependency resolution.
implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.4"
Go to this link for more info https://github.com/Kotlin/kotlinx.collections.immutable/issues/96#issuecomment-812994820
I had a spell error and caused the wrong like this, check if you had a spell error.
For my case ,I spelled 'org.jetbrains.kotlinx:kotlinx-coroutines-android' to 'org.jetbrains.kotlinx:kotlinx-coroutinesandroid' and caused the build error

mapbox annotation 0.9.0 not work with mapbox 9.6.0

I added mapbox and its annotation dependency like below:
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0'
api 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
every things worked well, but since I have changed mapbox version from 9.2.0 to 9.6.0 got this error when run my app.
Attention: Build is successful, but app not run correctly. Also this error occurs with v9.4.0 and 9.5.0.
Error:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.0.
Searched in the following locations:
- https://jcenter.bintray.com/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://maven.google.com/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
Required by:
project :app > project :mapir-android-sdk
> Could not find com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.0.
Searched in the following locations:
- https://jcenter.bintray.com/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://maven.google.com/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.0/mapbox-android-sdk-9.6.0.pom
Required by:
project :app > project :mapir-android-sdk > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Starting with Mapbox Maps SDK for Android version 9.4, the way to access the Maven repository to download the SDK libraries has changed.
You now need to create a secret access token and use it to access the maven repo, where the libraries are located. Your module level build.gradle should contain this:
allprojects {
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
}
Please also see:
https://docs.mapbox.com/android/maps/overview/#configure-credentials

Could not get unknown property 'manifestOutputDirectory'

I'm trying to "make project" with Android Studio, and I'm getting this error:
Execution failed for task ':myApp:processGoogleDebugManifest'.
Could not get unknown property 'manifestOutputDirectory' for task ':myApp:processGoogleDebugManifest' of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
Any help please?
EDIT: This error occurred after I updated to gradle v6.5 and plugin v4.1.0. If I revert to gradle v6.1.1 and plugin v4.0.0 the error disappears.
I encountered this same issue today, in my case it was caused by an outdated version of Huawei's AG Connect plugin. I was using com.huawei.agconnect:agcp:1.2.1.301, but when I updated it to com.huawei.agconnect:agcp:1.4.1.300 the issue was fixed.
See Latest Huawei's AG Connect plugin here: https://developer.huawei.com/latest/plugin/agconnect ...Just scroll, you'll find it there haha!
But if Huawei's plugin is not the problem you are having, you can debug the issue by running gradle with --stacktrace option to see where the issue originates from. In Android Studio you can add command line options for gradle in Settings/Build, Execution, Deployment/Compiler/Command-line options.
This solved my same problem:
In the project level build.gradle, replace this:
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
with this:
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
Reference: https://github.com/Tencent/tinker/issues/1471#issuecomment-710777366
If you're using bugsnag, replace the following line
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'
with:
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'
For further detail, see this issue: Fails with AGP 4.1.0-alpha04 and this comment.
I write it here because this solution saved my day :
We can fix this by simply replacing references to
manifestOutputDirectory
by
multiApkManifestOutputDirectory
enter code here
in your gradle tasks
For example :
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
output.processManifest.doLast { task ->
def outputDir = multiApkManifestOutputDirectory.asFile.get()
String manifestMergerpath = "$outputDir/AndroidManifest.xml"
writeManifest(manifestMergerpath, placeholders)
}
}
}
android.applicationVariants.all {
outputs.all {
processManifestProvider.configure {
val multiApkManifestOutputDirectory = (this as ProcessMultiApkApplicationManifest)
.multiApkManifestOutputDirectory // 👈
doLast {
multiApkManifestOutputDirectory.get()
.asFile
.walkTopDown()
.forEach {
}
}
}
}
}

lintOptions not being recognized by Gradle

So, first, some information about my setup. I'm trying to build an app, that includes different modules, in Android Studio. I have the following dependencies in my top-level build.gradle file:
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.9.3'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.3'
classpath 'com.google.gms:google-services:3.0.0'
}
I tried to disable Lint in one of my modules, because I was getting Lint errors that I'll investigate later (for the moment, I just want to get a build going). I used the following setting in one of my modules:
android {
[...]
lintOptions {
abortOnError false
}
[...]
}
However, I'm getting the following error:
Error:(48, 0) No signature of method:
com.android.build.gradle.managed.AndroidConfig.lintOptions() is applicable for argument types:
(build_9pxacuo2f46evz0elkujz25xa$_run_closure1$_closure4$_closure11)
values:[build_9pxacuo2f46evz0elkujz25xa$_run_closure1$_closure4$_closure11#96dc8be]
I already researched the appropriate documentation, and things seem to be right:
https://developer.android.com/studio/build/gradle-tips.html
What could I be doing wrong here? Many thanks for any help on this matter.
Apparently I have to write things this way (it is very strange, but I'm able to builld fine now):
model {
android.lintOptions {
abortOnError false
}
android {
// Rest of the other declarations goes here...
}
}
I don't know why this is working, I only know that it works. Once I have more time (I'm in a time crunch now) I'll come back to this to see if I can investigate this further and find out the reasons for this weird way to specifying the lintOptions...
Gradle experimental plugin wraps android block into model block and the lintOptions method does not accept closure.
For use android block try this code:
model {
android {
[...]
lintOptions.abortOnError false
[...]
}
}
See the documentation here: http://tools.android.com/tech-docs/new-build-system/gradle-experimental

Categories

Resources